mirror of
https://github.com/neovim/neovim.git
synced 2025-09-22 11:18:19 +00:00
vim-patch:9.0.0031: <mods> of user command does not have correct verbose value (#19215)
vim-patch:9.0.0031: <mods> of user command does not have correct verbose value
Problem: <mods> of user command does not have correct verbose value.
Solution: Use the value from the command modifier. (closes vim/vim#10651)
9359e8a6d9
This commit is contained in:
@@ -1605,10 +1605,10 @@ The valid escape sequences are
|
|||||||
nothing. Supported modifiers are |:aboveleft|, |:belowright|,
|
nothing. Supported modifiers are |:aboveleft|, |:belowright|,
|
||||||
|:botright|, |:browse|, |:confirm|, |:hide|, |:keepalt|,
|
|:botright|, |:browse|, |:confirm|, |:hide|, |:keepalt|,
|
||||||
|:keepjumps|, |:keepmarks|, |:keeppatterns|, |:leftabove|,
|
|:keepjumps|, |:keepmarks|, |:keeppatterns|, |:leftabove|,
|
||||||
|:lockmarks|, |:noswapfile| |:rightbelow|, |:silent|, |:tab|,
|
|:lockmarks|, |:noautocmd|, |:noswapfile| |:rightbelow|,
|
||||||
|:topleft|, |:verbose|, and |:vertical|.
|
|:sandbox|, |:silent|, |:tab|, |:topleft|, |:unsilent|,
|
||||||
Note that these are not yet supported: |:noautocmd|,
|
|:verbose|, and |:vertical|.
|
||||||
|:sandbox| and |:unsilent|.
|
Note that |:filter| is not supported.
|
||||||
Examples: >
|
Examples: >
|
||||||
command! -nargs=+ -complete=file MyEdit
|
command! -nargs=+ -complete=file MyEdit
|
||||||
\ for f in expand(<q-args>, 0, 1) |
|
\ for f in expand(<q-args>, 0, 1) |
|
||||||
|
@@ -6567,20 +6567,27 @@ size_t uc_mods(char *buf, const cmdmod_T *cmod, bool quote)
|
|||||||
|
|
||||||
// the modifiers that are simple flags
|
// the modifiers that are simple flags
|
||||||
for (size_t i = 0; i < ARRAY_SIZE(mod_entries); i++) {
|
for (size_t i = 0; i < ARRAY_SIZE(mod_entries); i++) {
|
||||||
if (cmdmod.cmod_flags & mod_entries[i].flag) {
|
if (cmod->cmod_flags & mod_entries[i].flag) {
|
||||||
result += add_cmd_modifier(buf, mod_entries[i].name, &multi_mods);
|
result += add_cmd_modifier(buf, mod_entries[i].name, &multi_mods);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// :silent
|
// :silent
|
||||||
if (msg_silent > 0) {
|
if (cmod->cmod_flags & CMOD_SILENT) {
|
||||||
result += add_cmd_modifier(buf,
|
result += add_cmd_modifier(buf,
|
||||||
(cmod->cmod_flags & CMOD_ERRSILENT) ? "silent!" : "silent",
|
(cmod->cmod_flags & CMOD_ERRSILENT) ? "silent!" : "silent",
|
||||||
&multi_mods);
|
&multi_mods);
|
||||||
}
|
}
|
||||||
// :verbose
|
// :verbose
|
||||||
if (p_verbose > 0) {
|
if (cmod->cmod_verbose > 0) {
|
||||||
result += add_cmd_modifier(buf, "verbose", &multi_mods);
|
int verbose_value = cmod->cmod_verbose - 1;
|
||||||
|
if (verbose_value == 1) {
|
||||||
|
result += add_cmd_modifier(buf, "verbose", &multi_mods);
|
||||||
|
} else {
|
||||||
|
char verbose_buf[NUMBUFLEN];
|
||||||
|
snprintf(verbose_buf, NUMBUFLEN, "%dverbose", verbose_value);
|
||||||
|
result += add_cmd_modifier(buf, verbose_buf, &multi_mods);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// flags from cmod->cmod_split
|
// flags from cmod->cmod_split
|
||||||
result += add_win_cmd_modifers(buf, cmod, &multi_mods);
|
result += add_win_cmd_modifers(buf, cmod, &multi_mods);
|
||||||
|
@@ -56,7 +56,10 @@ function Test_cmdmods()
|
|||||||
call assert_equal('lockmarks', g:mods)
|
call assert_equal('lockmarks', g:mods)
|
||||||
loc MyCmd
|
loc MyCmd
|
||||||
call assert_equal('lockmarks', g:mods)
|
call assert_equal('lockmarks', g:mods)
|
||||||
" noautocmd MyCmd
|
noautocmd MyCmd
|
||||||
|
call assert_equal('noautocmd', g:mods)
|
||||||
|
noa MyCmd
|
||||||
|
call assert_equal('noautocmd', g:mods)
|
||||||
noswapfile MyCmd
|
noswapfile MyCmd
|
||||||
call assert_equal('noswapfile', g:mods)
|
call assert_equal('noswapfile', g:mods)
|
||||||
nos MyCmd
|
nos MyCmd
|
||||||
@@ -70,29 +73,43 @@ function Test_cmdmods()
|
|||||||
call assert_equal('silent', g:mods)
|
call assert_equal('silent', g:mods)
|
||||||
sil MyCmd
|
sil MyCmd
|
||||||
call assert_equal('silent', g:mods)
|
call assert_equal('silent', g:mods)
|
||||||
|
silent! MyCmd
|
||||||
|
call assert_equal('silent!', g:mods)
|
||||||
|
sil! MyCmd
|
||||||
|
call assert_equal('silent!', g:mods)
|
||||||
tab MyCmd
|
tab MyCmd
|
||||||
call assert_equal('tab', g:mods)
|
call assert_equal('tab', g:mods)
|
||||||
topleft MyCmd
|
topleft MyCmd
|
||||||
call assert_equal('topleft', g:mods)
|
call assert_equal('topleft', g:mods)
|
||||||
to MyCmd
|
to MyCmd
|
||||||
call assert_equal('topleft', g:mods)
|
call assert_equal('topleft', g:mods)
|
||||||
" unsilent MyCmd
|
unsilent MyCmd
|
||||||
|
call assert_equal('unsilent', g:mods)
|
||||||
|
uns MyCmd
|
||||||
|
call assert_equal('unsilent', g:mods)
|
||||||
verbose MyCmd
|
verbose MyCmd
|
||||||
call assert_equal('verbose', g:mods)
|
call assert_equal('verbose', g:mods)
|
||||||
verb MyCmd
|
verb MyCmd
|
||||||
call assert_equal('verbose', g:mods)
|
call assert_equal('verbose', g:mods)
|
||||||
|
0verbose MyCmd
|
||||||
|
call assert_equal('0verbose', g:mods)
|
||||||
|
3verbose MyCmd
|
||||||
|
call assert_equal('3verbose', g:mods)
|
||||||
|
999verbose MyCmd
|
||||||
|
call assert_equal('999verbose', g:mods)
|
||||||
vertical MyCmd
|
vertical MyCmd
|
||||||
call assert_equal('vertical', g:mods)
|
call assert_equal('vertical', g:mods)
|
||||||
vert MyCmd
|
vert MyCmd
|
||||||
call assert_equal('vertical', g:mods)
|
call assert_equal('vertical', g:mods)
|
||||||
|
|
||||||
aboveleft belowright botright browse confirm hide keepalt keepjumps
|
aboveleft belowright botright browse confirm hide keepalt keepjumps
|
||||||
\ keepmarks keeppatterns lockmarks noswapfile silent tab
|
\ keepmarks keeppatterns lockmarks noautocmd noswapfile silent
|
||||||
\ topleft verbose vertical MyCmd
|
\ tab topleft unsilent verbose vertical MyCmd
|
||||||
|
|
||||||
call assert_equal('browse confirm hide keepalt keepjumps ' .
|
call assert_equal('browse confirm hide keepalt keepjumps ' .
|
||||||
\ 'keepmarks keeppatterns lockmarks noswapfile silent ' .
|
\ 'keepmarks keeppatterns lockmarks noswapfile unsilent noautocmd ' .
|
||||||
\ 'verbose aboveleft belowright botright tab topleft vertical', g:mods)
|
\ 'silent verbose aboveleft belowright botright tab topleft vertical',
|
||||||
|
\ g:mods)
|
||||||
|
|
||||||
let g:mods = ''
|
let g:mods = ''
|
||||||
command! -nargs=* MyQCmd let g:mods .= '<q-mods> '
|
command! -nargs=* MyQCmd let g:mods .= '<q-mods> '
|
||||||
|
Reference in New Issue
Block a user