Mercurial > vim
comparison src/testdir/test_cmdline.vim @ 32796:e98fc0c439aa v9.0.1714
patch 9.0.1714: getcompletion() "cmdline" fails after :autocmd
Commit: https://github.com/vim/vim/commit/e4c79d36150431ffb97cb8952ec482af2e57f228
Author: zeertzjq <zeertzjq@outlook.com>
Date: Tue Aug 15 22:41:53 2023 +0200
patch 9.0.1714: getcompletion() "cmdline" fails after :autocmd
Problem: getcompletion() "cmdline" fails after :autocmd
Solution: Use set_cmd_context() instead of set_one_cmd_context().
closes: #12804
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 15 Aug 2023 23:00:03 +0200 |
parents | a61007fbc2a3 |
children | 306f51627f50 |
comparison
equal
deleted
inserted
replaced
32795:4e591c4c4fe7 | 32796:e98fc0c439aa |
---|---|
610 call assert_equal([], l) | 610 call assert_equal([], l) |
611 let l = getcompletion('call tag', 'cmdline') | 611 let l = getcompletion('call tag', 'cmdline') |
612 call assert_true(index(l, 'taglist(') >= 0) | 612 call assert_true(index(l, 'taglist(') >= 0) |
613 let l = getcompletion('call paint', 'cmdline') | 613 let l = getcompletion('call paint', 'cmdline') |
614 call assert_equal([], l) | 614 call assert_equal([], l) |
615 let l = getcompletion('autocmd BufEnter * map <bu', 'cmdline') | |
616 call assert_equal(['<buffer>'], l) | |
615 | 617 |
616 func T(a, c, p) | 618 func T(a, c, p) |
617 let g:cmdline_compl_params = [a:a, a:c, a:p] | 619 let g:cmdline_compl_params = [a:a, a:c, a:p] |
618 return "oneA\noneB\noneC" | 620 return "oneA\noneB\noneC" |
619 endfunc | 621 endfunc |
3496 | 3498 |
3497 " clean up | 3499 " clean up |
3498 call StopVimInTerminal(buf) | 3500 call StopVimInTerminal(buf) |
3499 endfunc | 3501 endfunc |
3500 | 3502 |
3501 func Test_usercmd_completion() | 3503 func Test_getcompletion_usercmd() |
3502 let g:complete=[] | |
3503 command! -nargs=* -complete=command TestCompletion echo <q-args> | 3504 command! -nargs=* -complete=command TestCompletion echo <q-args> |
3504 let g:complete = getcompletion('TestCompletion ', 'cmdline') | 3505 |
3505 let a = getcompletion('', 'cmdline') | 3506 call assert_equal(getcompletion('', 'cmdline'), |
3506 | 3507 \ getcompletion('TestCompletion ', 'cmdline')) |
3507 call assert_equal(a, g:complete) | 3508 call assert_equal(['<buffer>'], |
3509 \ getcompletion('TestCompletion map <bu', 'cmdline')) | |
3510 | |
3508 delcom TestCompletion | 3511 delcom TestCompletion |
3509 unlet! g:complete | 3512 endfunc |
3510 endfunc | 3513 |
3511 " vim: shiftwidth=2 sts=2 expandtab | 3514 " vim: shiftwidth=2 sts=2 expandtab |