diff options
author | Yee Cheng Chin <ychin.git@gmail.com> | 2023-10-14 11:46:51 +0200 |
---|---|---|
committer | Christian Brabandt <cb@256bit.org> | 2023-10-14 11:46:51 +0200 |
commit | 989426be6e9ae23d2413943890206cbe15d9df38 (patch) | |
tree | 3931aedc70ed18a7e3ea0f735359995fb26d1ef5 /src/testdir/test_cmdline.vim | |
parent | bd734c3bead9e167eb6875f62cc06fab2379c422 (diff) |
patch 9.0.2025: no cmdline completion for ++opt argsv9.0.2025
Problem: no cmdline completion for ++opt args
Solution: Add cmdline completion for :e ++opt=arg and :terminal
[++options]
closes: #13319
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
Diffstat (limited to 'src/testdir/test_cmdline.vim')
-rw-r--r-- | src/testdir/test_cmdline.vim | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim index e79fa72bba..ddfeba28ff 100644 --- a/src/testdir/test_cmdline.vim +++ b/src/testdir/test_cmdline.vim @@ -1083,6 +1083,46 @@ func Test_cmdline_complete_expression() unlet g:SomeVar endfunc +func Test_cmdline_complete_argopt() + " completion for ++opt=arg for file commands + call assert_equal('fileformat=', getcompletion('edit ++', 'cmdline')[0]) + call assert_equal('encoding=', getcompletion('read ++e', 'cmdline')[0]) + call assert_equal('edit', getcompletion('read ++bin ++edi', 'cmdline')[0]) + + call assert_equal(['fileformat='], getcompletion('edit ++ff', 'cmdline')) + + call assert_equal('dos', getcompletion('write ++ff=d', 'cmdline')[0]) + call assert_equal('mac', getcompletion('args ++fileformat=m', 'cmdline')[0]) + call assert_equal('utf-8', getcompletion('split ++enc=ut*-8', 'cmdline')[0]) + call assert_equal('latin1', getcompletion('tabedit ++encoding=lati', 'cmdline')[0]) + call assert_equal('keep', getcompletion('edit ++bad=k', 'cmdline')[0]) + + call assert_equal([], getcompletion('edit ++bogus=', 'cmdline')) + + " completion should skip the ++opt and continue + call writefile([], 'Xaaaaa.txt', 'D') + call feedkeys(":split ++enc=latin1 Xaaa\<C-A>\<C-B>\"\<CR>", 'xt') + call assert_equal('"split ++enc=latin1 Xaaaaa.txt', @:) + + if has('terminal') + " completion for terminal's [options] + call assert_equal('close', getcompletion('terminal ++cl*e', 'cmdline')[0]) + call assert_equal('hidden', getcompletion('terminal ++open ++hidd', 'cmdline')[0]) + call assert_equal('term', getcompletion('terminal ++kill=ter', 'cmdline')[0]) + + call assert_equal([], getcompletion('terminal ++bogus=', 'cmdline')) + + " :terminal completion should skip the ++opt when considering what is the + " first option, which is a list of shell commands, unlike second option + " onwards. + let first_param = getcompletion('terminal ', 'cmdline') + let second_param = getcompletion('terminal foo ', 'cmdline') + let skipped_opt_param = getcompletion('terminal ++close ', 'cmdline') + call assert_equal(first_param, skipped_opt_param) + call assert_notequal(first_param, second_param) + endif +endfunc + " Unique function name for completion below func s:WeirdFunc() echo 'weird' |