From 3cd5ef63fd17a4eb294856360039803f31a10a76 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 16 Aug 2023 06:07:01 +0800 Subject: vim-patch:9.0.1714: getcompletion() "cmdline" fails after :autocmd (#24727) Problem: getcompletion() "cmdline" fails after :autocmd Solution: Use set_cmd_context() instead of set_one_cmd_context(). closes: vim/vim#12804 https://github.com/vim/vim/commit/e4c79d36150431ffb97cb8952ec482af2e57f228 --- test/old/testdir/test_cmdline.vim | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/old/testdir/test_cmdline.vim b/test/old/testdir/test_cmdline.vim index 506b3d41ff..eaea31f3eb 100644 --- a/test/old/testdir/test_cmdline.vim +++ b/test/old/testdir/test_cmdline.vim @@ -601,6 +601,8 @@ func Test_getcompletion() call assert_true(index(l, 'taglist(') >= 0) let l = getcompletion('call paint', 'cmdline') call assert_equal([], l) + let l = getcompletion('autocmd BufEnter * map '], l) func T(a, c, p) let g:cmdline_compl_params = [a:a, a:c, a:p] @@ -3636,14 +3638,15 @@ func Test_rulerformat_position() call StopVimInTerminal(buf) endfunc -func Test_usercmd_completion() - let g:complete=[] +func Test_getcompletion_usercmd() command! -nargs=* -complete=command TestCompletion echo - let g:complete = getcompletion('TestCompletion ', 'cmdline') - let a = getcompletion('', 'cmdline') - call assert_equal(a, g:complete) + call assert_equal(getcompletion('', 'cmdline'), + \ getcompletion('TestCompletion ', 'cmdline')) + call assert_equal([''], + \ getcompletion('TestCompletion map