From 8bbcd3e00e91c42040ccf991c64fc52b746d65fc Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 31 Aug 2026 10:49:45 +0800 Subject: [PATCH] vim-patch:9.2.1024: 'wildmode' list:full does not complete first match Problem: With 'wildmode' set to list:full, matches are listed but the first match is not completed on the first Tab press (rendcrx). Solution: Do not suppress selection when list and full are active in the same completion phase. Add regression tests for file completion, comma-separated phases and noselect precedence (Seunghee Kim). fixes: vim/vim#19532 related: vim/vim#18088 closes: vim/vim#21181 https://github.com/vim/vim/commit/54c988c6c57bff3db35d7df1dcacd484e3d9610c Co-authored-by: SeungheeKim --- src/nvim/ex_getln.c | 2 +- test/old/testdir/test_cmdline.vim | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index ada5d96a16..feedb76e86 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -1184,7 +1184,7 @@ static int command_line_wildchar_complete(CommandLineState *s) if (wim_longest) { res = nextwild(&s->xpc, WILD_LONGEST, options, escape); } else { - if (wim_noselect || wim_list) { + if (wim_noselect || (wim_list && !wim_full)) { options |= WILD_NOSELECT; } if (wim_noinsert) { diff --git a/test/old/testdir/test_cmdline.vim b/test/old/testdir/test_cmdline.vim index 6edf0cdba4..ae563ad5e1 100644 --- a/test/old/testdir/test_cmdline.vim +++ b/test/old/testdir/test_cmdline.vim @@ -2273,6 +2273,27 @@ func Wildmode_tests() call assert_equal('oneA oneB oneC', g:Sline) call assert_equal('"MyCmd one', @:) + " Colon-separated modes apply during the same completion phase. + call writefile([], 'XwildmodeA', 'D') + call writefile([], 'XwildmodeB', 'D') + call writefile([], 'XwildmodeC', 'D') + set wildmode=list:full + let g:Sline = '' + call feedkeys(":e Xwildmode\t\\\"\", 'xt') + call assert_equal('XwildmodeA XwildmodeB XwildmodeC', g:Sline) + call assert_equal('"e XwildmodeA', @:) + call feedkeys(":e Xwildmode\t\t\\"\", 'xt') + call assert_equal('"e XwildmodeB', @:) + + " Comma-separated modes apply on consecutive Tab presses. + set wildmode=list,full + let g:Sline = '' + call feedkeys(":MyCmd o\t\\\"\", 'xt') + call assert_equal('oneA oneB oneC', g:Sline) + call assert_equal('"MyCmd o', @:) + call feedkeys(":MyCmd o\t\t\\"\", 'xt') + call assert_equal('"MyCmd oneA', @:) + set wildmode="" call feedkeys(":MyCmd \t\t\\"\", 'xt') call assert_equal('"MyCmd oneA', @:) @@ -2307,6 +2328,13 @@ func Wildmode_tests() call feedkeys(":MyCmd o\t\t\\\"\", 'xt') call assert_equal('"MyCmd o', @:) + " 'noselect' takes precedence over 'full' on the first Tab. + set wildmode=noselect:full + call feedkeys(":MyCmd o\t\\"\", 'xt') + call assert_equal('"MyCmd o', @:) + call feedkeys(":MyCmd o\t\t\\"\", 'xt') + call assert_equal('"MyCmd oneA', @:) + " When 'full' is present, complete after first . set wildmode=noselect,full call feedkeys(":MyCmd o\t\\"\", 'xt')