]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.2098: Crash with 'wildmenu' when typing Ctrl-Y after Ctrl-A v9.1.2098
authorzeertzjq <zeertzjq@outlook.com>
Mon, 19 Jan 2026 19:02:08 +0000 (19:02 +0000)
committerChristian Brabandt <cb@256bit.org>
Mon, 19 Jan 2026 19:02:08 +0000 (19:02 +0000)
Problem:  Crash with 'wildmenu' when typing Ctrl-Y after Ctrl-A
          (after 9.1.1714) (fizz-is-on-the-way).
Solution: Check if there are matches before applying one (zeertzjq).

closes: #19210

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/ex_getln.c
src/testdir/test_cmdline.vim
src/version.c

index 0ec7293199ae514b0e52b754371646681256fdc5..65d4c6957726c20c47b783fa4f87da308e376fd9 100644 (file)
@@ -1994,7 +1994,7 @@ getcmdline_int(
 
        int key_is_wc = (c == p_wc && KeyTyped) || c == p_wcm;
        if ((cmdline_pum_active() || wild_menu_showing || did_wild_list)
-               && !key_is_wc)
+               && !key_is_wc && xpc.xp_numfiles > 0)
        {
            // Ctrl-Y: Accept the current selection and close the popup menu.
            // Ctrl-E: cancel the cmdline popup menu and return the original
index b4d11ac9d234f7877cd51c58e89bcb0f5c58b1ef..ea018d5932604fea69982bd0608905d73aa7ba64 100644 (file)
@@ -162,6 +162,16 @@ func Test_complete_wildmenu()
   call feedkeys(":sign un zz\<Left>\<Left>\<Left>\<Tab>\<Tab>\<C-Y> yy\<C-B>\"\<CR>", 'tx')
   call assert_equal('"sign unplace yy zz', @:)
 
+  " This used to crash
+  call feedkeys(":sign un\<Tab>\<S-Tab>\<C-A>\<C-Y>\<C-B>\"\<CR>", 'tx')
+  " Ctrl-Y is inserted literally like before 9.1.1714
+  call assert_equal("\"sign undefine unplace\<C-Y>", @:)
+  " Also test Ctrl-Y after Ctrl-A with selected item (the result is the same)
+  call feedkeys(":sign un\<Tab>\<C-A>\<C-Y>\<C-B>\"\<CR>", 'tx')
+  call assert_equal("\"sign undefine unplace\<C-Y>", @:)
+  call feedkeys(":sign un\<Tab>\<Tab>\<C-A>\<C-Y>\<C-B>\"\<CR>", 'tx')
+  call assert_equal("\"sign undefine unplace\<C-Y>", @:)
+
   " cleanup
   %bwipe
   set nowildmenu
index ede881cf95649c040f1af95c478031ffa84bbfae..4790f8de2ed9f956f169c1e4cda3280638828daf 100644 (file)
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2098,
 /**/
     2097,
 /**/