Skip to content

Commit 126731c

Browse files
dkearnschrisbra
authored andcommitted
patch 9.1.1608: No command-line completion for :unsilent {command}
Problem: No command-line completion for :unsilent {command}. Solution: Add missing command arg completion (Doug Kearns). (author) Add completion tests for all command modifiers. closes: #17524 Signed-off-by: Doug Kearns <dougkearns@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
1 parent efd83d4 commit 126731c

3 files changed

Lines changed: 27 additions & 12 deletions

File tree

src/cmdexpand.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2361,6 +2361,7 @@ set_context_by_cmdname(
23612361
case CMD_tab:
23622362
case CMD_tabdo:
23632363
case CMD_topleft:
2364+
case CMD_unsilent:
23642365
case CMD_verbose:
23652366
case CMD_vertical:
23662367
case CMD_windo:

src/testdir/test_cmdmods.vim

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,29 @@
11
" Test for all command modifiers in
22

3+
def s:memoize_cmdmods(): func(): list<string>
4+
var cmdmods: list<string> = []
5+
return () => {
6+
if empty(cmdmods)
7+
edit ../ex_docmd.c
8+
var top = search('^static cmdmod_info_T cmdmod_info_tab[') + 1
9+
var bot = search('^};.*\/\/ cmdmod_info_tab') - 1
10+
var lines = getline(top, bot)
11+
cmdmods = lines->map((_, v) => substitute(v, '.*"\(\k*\)".*', '\1', ''))
12+
bwipe!
13+
endif
14+
return cmdmods
15+
}
16+
enddef
17+
let s:get_cmdmods = s:memoize_cmdmods()
18+
319
def Test_cmdmods_array()
420
# Get all the command modifiers from ex_cmds.h.
521
var lines = readfile('../ex_cmds.h')->filter((_, l) => l =~ 'ex_wrongmodifier,')
622
var cmds = lines->map((_, v) => substitute(v, '.*"\(\k*\)".*', '\1', ''))
7-
823
# :hide is both a command and a modifier
924
cmds->extend(['hide'])
1025

11-
# Get the entries of cmdmod_info_tab[] in ex_docmd.c
12-
edit ../ex_docmd.c
13-
var top = search('^static cmdmod_info_T cmdmod_info_tab[') + 1
14-
var bot = search('^};.*\/\/ cmdmod_info_tab') - 1
15-
lines = getline(top, bot)
16-
var mods = lines->map((_, v) => substitute(v, '.*"\(\k*\)".*', '\1', ''))
17-
26+
var mods = s:get_cmdmods()
1827
# Add the other commands that use ex_wrongmodifier.
1928
mods->extend([
2029
'endclass',
@@ -73,10 +82,13 @@ def Test_keep_cmdmods_names()
7382
enddef
7483

7584
def Test_cmdmod_completion()
76-
assert_equal('edit', getcompletion('keepalt ed', 'cmdline')[0])
77-
assert_equal('edit', getcompletion('keepjumps ed', 'cmdline')[0])
78-
assert_equal('edit', getcompletion('keepmarks ed', 'cmdline')[0])
79-
assert_equal('edit', getcompletion('keeppatterns ed', 'cmdline')[0])
85+
for mod in s:get_cmdmods()
86+
var cmd = $'{mod} ed'
87+
if mod == 'filter'
88+
cmd = $'{mod} /pattern/ ed'
89+
endif
90+
assert_equal('edit', getcompletion(cmd, 'cmdline')[0])
91+
endfor
8092
enddef
8193

8294
" vim: shiftwidth=2 sts=2 expandtab

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,8 @@ static char *(features[]) =
719719

720720
static int included_patches[] =
721721
{ /* Add new patch number below this line */
722+
/**/
723+
1608,
722724
/**/
723725
1607,
724726
/**/

0 commit comments

Comments
 (0)