patch 9.1.2098: Crash with 'wildmenu' when typing Ctrl-Y after Ctrl-A

Commit: 
https://github.com/vim/vim/commit/311b98d94256038fd2a5a823edcb6ab50d2fc8e8
Author: zeertzjq <[email protected]>
Date:   Mon Jan 19 19:02:08 2026 +0000

    patch 9.1.2098: Crash with 'wildmenu' when typing Ctrl-Y after Ctrl-A
    
    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 <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/src/ex_getln.c b/src/ex_getln.c
index 0ec729319..65d4c6957 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -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
diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim
index b4d11ac9d..ea018d593 100644
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -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
diff --git a/src/version.c b/src/version.c
index ede881cf9..4790f8de2 100644
--- a/src/version.c
+++ b/src/version.c
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2098,
 /**/
     2097,
 /**/

-- 
-- 
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 visit 
https://groups.google.com/d/msgid/vim_dev/E1vhuiN-003Zz7-Pb%40256bit.org.

Raspunde prin e-mail lui