mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
Merge 8ea95b3232357045d0a8813a2bf5db628d02f8f1 into a494ce1c64a2637719a5c1339abf19ec7c48089c
This commit is contained in:
commit
ccab6f7d0a
@ -2345,6 +2345,7 @@ set_context_by_cmdname(
|
|||||||
case CMD_tab:
|
case CMD_tab:
|
||||||
case CMD_tabdo:
|
case CMD_tabdo:
|
||||||
case CMD_topleft:
|
case CMD_topleft:
|
||||||
|
case CMD_unsilent:
|
||||||
case CMD_verbose:
|
case CMD_verbose:
|
||||||
case CMD_vertical:
|
case CMD_vertical:
|
||||||
case CMD_windo:
|
case CMD_windo:
|
||||||
|
@ -1,20 +1,29 @@
|
|||||||
" Test for all command modifiers in
|
" Test for all command modifiers in
|
||||||
|
|
||||||
|
def s:_get_cmdmods(): func(): list<string>
|
||||||
|
var cmdmods: list<string> = []
|
||||||
|
return () => {
|
||||||
|
if empty(cmdmods)
|
||||||
|
edit ../ex_docmd.c
|
||||||
|
var top = search('^static cmdmod_info_T cmdmod_info_tab[') + 1
|
||||||
|
var bot = search('^};.*\/\/ cmdmod_info_tab') - 1
|
||||||
|
var lines = getline(top, bot)
|
||||||
|
cmdmods = lines->map((_, v) => substitute(v, '.*"\(\k*\)".*', '\1', ''))
|
||||||
|
bwipe!
|
||||||
|
endif
|
||||||
|
return cmdmods
|
||||||
|
}
|
||||||
|
enddef
|
||||||
|
let s:get_cmdmods = s:_get_cmdmods()
|
||||||
|
|
||||||
def Test_cmdmods_array()
|
def Test_cmdmods_array()
|
||||||
# Get all the command modifiers from ex_cmds.h.
|
# Get all the command modifiers from ex_cmds.h.
|
||||||
var lines = readfile('../ex_cmds.h')->filter((_, l) => l =~ 'ex_wrongmodifier,')
|
var lines = readfile('../ex_cmds.h')->filter((_, l) => l =~ 'ex_wrongmodifier,')
|
||||||
var cmds = lines->map((_, v) => substitute(v, '.*"\(\k*\)".*', '\1', ''))
|
var cmds = lines->map((_, v) => substitute(v, '.*"\(\k*\)".*', '\1', ''))
|
||||||
|
|
||||||
# :hide is both a command and a modifier
|
# :hide is both a command and a modifier
|
||||||
cmds->extend(['hide'])
|
cmds->extend(['hide'])
|
||||||
|
|
||||||
# Get the entries of cmdmod_info_tab[] in ex_docmd.c
|
var mods = s:get_cmdmods()
|
||||||
edit ../ex_docmd.c
|
|
||||||
var top = search('^static cmdmod_info_T cmdmod_info_tab[') + 1
|
|
||||||
var bot = search('^};.*\/\/ cmdmod_info_tab') - 1
|
|
||||||
lines = getline(top, bot)
|
|
||||||
var mods = lines->map((_, v) => substitute(v, '.*"\(\k*\)".*', '\1', ''))
|
|
||||||
|
|
||||||
# Add the other commands that use ex_wrongmodifier.
|
# Add the other commands that use ex_wrongmodifier.
|
||||||
mods->extend([
|
mods->extend([
|
||||||
'endclass',
|
'endclass',
|
||||||
@ -73,10 +82,13 @@ def Test_keep_cmdmods_names()
|
|||||||
enddef
|
enddef
|
||||||
|
|
||||||
def Test_cmdmod_completion()
|
def Test_cmdmod_completion()
|
||||||
assert_equal('edit', getcompletion('keepalt ed', 'cmdline')[0])
|
for mod in s:get_cmdmods()
|
||||||
assert_equal('edit', getcompletion('keepjumps ed', 'cmdline')[0])
|
var cmd = $'{mod} ed'
|
||||||
assert_equal('edit', getcompletion('keepmarks ed', 'cmdline')[0])
|
if mod == 'filter'
|
||||||
assert_equal('edit', getcompletion('keeppatterns ed', 'cmdline')[0])
|
cmd = $'{mod} /pattern/ ed'
|
||||||
|
endif
|
||||||
|
assert_equal('edit', getcompletion(cmd, 'cmdline')[0])
|
||||||
|
endfor
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2 expandtab
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
Loading…
x
Reference in New Issue
Block a user