Patch 8.2.2296
Problem: Cannot use CTRL-N and CTRL-P in a popup menu.
Solution: Use CTRL-N like <Down> and CTRL-P like <Up>. (closes #7614)
Files: runtime/doc/popup.txt, src/popupwin.c,
src/testdir/test_popupwin.vim
*** ../vim-8.2.2295/runtime/doc/popup.txt 2020-09-28 22:29:25.421766301
+0200
--- runtime/doc/popup.txt 2021-01-04 13:14:33.471982199 +0100
***************
*** 309,319 ****
popup_filter_menu({id}, {key})
*popup_filter_menu()*
Filter that can be used for a popup. These keys can be used:
! j <Down> select item below
! k <Up> select item above
<Space> <Enter> accept current selection
x Esc CTRL-C cancel the menu
Other keys are ignored.
A match is set on that line to highlight it, see
|popup_menu()|.
--- 309,320 ----
popup_filter_menu({id}, {key})
*popup_filter_menu()*
Filter that can be used for a popup. These keys can be used:
! j <Down> <C-N> select item below
! k <Up> <C-P> select item above
<Space> <Enter> accept current selection
x Esc CTRL-C cancel the menu
Other keys are ignored.
+ Always returns |v:true|.
A match is set on that line to highlight it, see
|popup_menu()|.
*** ../vim-8.2.2295/src/popupwin.c 2020-12-29 11:57:42.647631659 +0100
--- src/popupwin.c 2021-01-04 13:17:01.659472185 +0100
***************
*** 2380,2388 ****
res.v_type = VAR_NUMBER;
old_lnum = wp->w_cursor.lnum;
! if ((c == 'k' || c == 'K' || c == K_UP) && wp->w_cursor.lnum > 1)
--wp->w_cursor.lnum;
! if ((c == 'j' || c == 'J' || c == K_DOWN)
&& wp->w_cursor.lnum < wp->w_buffer->b_ml.ml_line_count)
++wp->w_cursor.lnum;
if (old_lnum != wp->w_cursor.lnum)
--- 2380,2389 ----
res.v_type = VAR_NUMBER;
old_lnum = wp->w_cursor.lnum;
! if ((c == 'k' || c == 'K' || c == K_UP || c == Ctrl_P)
! && wp->w_cursor.lnum > 1)
--wp->w_cursor.lnum;
! if ((c == 'j' || c == 'J' || c == K_DOWN || c == Ctrl_N)
&& wp->w_cursor.lnum < wp->w_buffer->b_ml.ml_line_count)
++wp->w_cursor.lnum;
if (old_lnum != wp->w_cursor.lnum)
*** ../vim-8.2.2295/src/testdir/test_popupwin.vim 2020-12-29
11:57:42.647631659 +0100
--- src/testdir/test_popupwin.vim 2021-01-04 13:14:33.471982199 +0100
***************
*** 3797,3800 ****
--- 3797,3806 ----
endtry
endfunc
+ func Test_popup_filter_menu()
+ let colors = ['red', 'green', 'blue']
+ call popup_menu(colors, #{callback: {_, result -> assert_equal('green',
colors[result - 1])}})
+ call feedkeys("\<c-n>\<c-n>\<c-p>\<cr>", 'xt')
+ endfunc
+
" vim: shiftwidth=2 sts=2
*** ../vim-8.2.2295/src/version.c 2021-01-04 12:41:49.511891327 +0100
--- src/version.c 2021-01-04 13:16:15.527631336 +0100
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2296,
/**/
--
There's no place like $(HOME)!
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202101041219.104CJ1Ou2419374%40masaka.moolenaar.net.