mirror of
https://github.com/neovim/neovim.git
synced 2026-11-02 09:49:02 -06:00
vim-patch:9.1.2098: Crash with 'wildmenu' when typing Ctrl-Y after Ctrl-A (#37466)
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: vim/vim#19210
https://github.com/vim/vim/commit/311b98d94256038fd2a5a823edcb6ab50d2fc8e8
This commit is contained in:
1 parent
8133760c98
commit
64057d266c
2 files changed
+12
-1
No files matched your search
+2
-1
@@ -1387,7 +1387,8 @@ static int command_line_execute(VimState *state, int key)
|
|||||||
|
|
||||||
int wild_type = 0;
|
int wild_type = 0;
|
||||||
const bool key_is_wc = (s->c == p_wc && KeyTyped) || s->c == p_wcm;
|
const bool key_is_wc = (s->c == p_wc && KeyTyped) || s->c == p_wcm;
|
||||||
if ((cmdline_pum_active() || wild_menu_showing || s->did_wild_list) && !key_is_wc) {
|
if ((cmdline_pum_active() || wild_menu_showing || s->did_wild_list)
|
||||||
|
&& !key_is_wc && s->xpc.xp_numfiles > 0) {
|
||||||
// Ctrl-Y: Accept the current selection and close the popup menu.
|
// Ctrl-Y: Accept the current selection and close the popup menu.
|
||||||
// Ctrl-E: cancel the cmdline popup menu and return the original text.
|
// Ctrl-E: cancel the cmdline popup menu and return the original text.
|
||||||
if (s->c == Ctrl_E || s->c == Ctrl_Y) {
|
if (s->c == Ctrl_E || s->c == Ctrl_Y) {
|
||||||
|
|||||||
@@ -166,6 +166,16 @@ func Test_complete_wildmenu()
|
|||||||
call feedkeys(":sign un zz\<Left>\<Left>\<Left>\<Tab>\<Tab>\<C-Y> yy\<C-B>\"\<CR>", 'tx')
|
call feedkeys(":sign un zz\<Left>\<Left>\<Left>\<Tab>\<Tab>\<C-Y> yy\<C-B>\"\<CR>", 'tx')
|
||||||
call assert_equal('"sign unplace yy zz', @:)
|
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
|
" cleanup
|
||||||
%bwipe
|
%bwipe
|
||||||
set nowildmenu
|
set nowildmenu
|
||||||
|
|||||||
Reference in new issue
Block a user