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

54c988c6c5

Co-authored-by: SeungheeKim <ksh368@naver.com>
This commit is contained in:
zeertzjq
2026-08-31 10:49:45 +08:00
parent b279472393
commit 8bbcd3e00e
2 changed files with 29 additions and 1 deletions

View File

@@ -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) {

View File

@@ -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\<F4>\<C-B>\"\<CR>", 'xt')
call assert_equal('XwildmodeA XwildmodeB XwildmodeC', g:Sline)
call assert_equal('"e XwildmodeA', @:)
call feedkeys(":e Xwildmode\t\t\<C-B>\"\<CR>", '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\<F4>\<C-B>\"\<CR>", 'xt')
call assert_equal('oneA oneB oneC', g:Sline)
call assert_equal('"MyCmd o', @:)
call feedkeys(":MyCmd o\t\t\<C-B>\"\<CR>", 'xt')
call assert_equal('"MyCmd oneA', @:)
set wildmode=""
call feedkeys(":MyCmd \t\t\<C-B>\"\<CR>", 'xt')
call assert_equal('"MyCmd oneA', @:)
@@ -2307,6 +2328,13 @@ func Wildmode_tests()
call feedkeys(":MyCmd o\t\t\<C-Y>\<C-B>\"\<CR>", 'xt')
call assert_equal('"MyCmd o', @:)
" 'noselect' takes precedence over 'full' on the first Tab.
set wildmode=noselect:full
call feedkeys(":MyCmd o\t\<C-B>\"\<CR>", 'xt')
call assert_equal('"MyCmd o', @:)
call feedkeys(":MyCmd o\t\t\<C-B>\"\<CR>", 'xt')
call assert_equal('"MyCmd oneA', @:)
" When 'full' is present, complete after first <tab>.
set wildmode=noselect,full
call feedkeys(":MyCmd o\t\<C-B>\"\<CR>", 'xt')