vim-patch:9.0.1956: Custom completion skips orig cmdline if it invokes glob() (#25427)

Problem:  Custom cmdline completion skips original cmdline when pressing
          Ctrl-P at first match if completion function invokes glob().
Solution: Move orig_save into struct expand_T.

closes: vim/vim#13216

28a23602e8
This commit is contained in:
zeertzjq
2023-09-30 06:30:10 +08:00
committed by GitHub
parent be463e7643
commit dbfdb52ea8
3 changed files with 31 additions and 14 deletions

View File

@@ -3702,4 +3702,20 @@ func Test_custom_completion()
delfunc Check_customlist_completion
endfunc
func Test_custom_completion_with_glob()
func TestGlobComplete(A, L, P)
return split(glob('Xglob*'), "\n")
endfunc
command -nargs=* -complete=customlist,TestGlobComplete TestGlobComplete :
call writefile([], 'Xglob1', 'D')
call writefile([], 'Xglob2', 'D')
call feedkeys(":TestGlobComplete \<Tab> \<Tab>\<C-N> \<Tab>\<C-P>;\<C-B>\"\<CR>", 'xt')
call assert_equal('"TestGlobComplete Xglob1 Xglob2 ;', @:)
delcommand TestGlobComplete
delfunc TestGlobComplete
endfunc
" vim: shiftwidth=2 sts=2 expandtab