To: vim_dev@googlegroups.com Subject: Patch 8.2.2296 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2296 Problem: Cannot use CTRL-N and CTRL-P in a popup menu. Solution: Use CTRL-N like and CTRL-P like . (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 select item below ! k select item above 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 select item below ! k select item above 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("\\\\", '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 -- Bram@Moolenaar.net -- 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 ///