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

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
parent f5b43bf1f3
commit d5c16d1bfe
3 changed files with 33 additions and 14 deletions

View File

@@ -3650,4 +3650,22 @@ func Test_getcompletion_usercmd()
delcom TestCompletion
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')
call writefile([], 'Xglob2')
call feedkeys(":TestGlobComplete \<Tab> \<Tab>\<C-N> \<Tab>\<C-P>;\<C-B>\"\<CR>", 'xt')
call assert_equal('"TestGlobComplete Xglob1 Xglob2 ;', @:)
call delete('Xglob1')
call delete('Xglob2')
delcommand TestGlobComplete
delfunc TestGlobComplete
endfunc
" vim: shiftwidth=2 sts=2 expandtab