vim-patch:9.0.0346: :horizontal modifier not fully supported

Problem:    :horizontal modifier not fully supported.
Solution:   Also use :horizontal for completion and user commands.
            (closes vim/vim#11025)
d3de178e53
This commit is contained in:
zeertzjq 2022-09-01 20:25:34 +08:00
parent c65b1f3e15
commit 56bf026dea
6 changed files with 19 additions and 5 deletions

View File

@ -1623,11 +1623,11 @@ The valid escape sequences are
*<mods>* *<q-mods>* *:command-modifiers* *<mods>* *<q-mods>* *:command-modifiers*
<mods> The command modifiers, if specified. Otherwise, expands to <mods> The command modifiers, if specified. Otherwise, expands to
nothing. Supported modifiers are |:aboveleft|, |:belowright|, nothing. Supported modifiers are |:aboveleft|, |:belowright|,
|:botright|, |:browse|, |:confirm|, |:hide|, |:keepalt|, |:botright|, |:browse|, |:confirm|, |:hide|, |:horizontal|,
|:keepjumps|, |:keepmarks|, |:keeppatterns|, |:leftabove|, |:keepalt|, |:keepjumps|, |:keepmarks|, |:keeppatterns|,
|:lockmarks|, |:noautocmd|, |:noswapfile| |:rightbelow|, |:leftabove|, |:lockmarks|, |:noautocmd|, |:noswapfile|
|:sandbox|, |:silent|, |:tab|, |:topleft|, |:unsilent|, |:rightbelow|, |:sandbox|, |:silent|, |:tab|, |:topleft|,
|:verbose|, and |:vertical|. |:unsilent|, |:verbose|, and |:vertical|.
Note that |:filter| is not supported. Note that |:filter| is not supported.
Examples: > Examples: >
command! -nargs=+ -complete=file MyEdit command! -nargs=+ -complete=file MyEdit

View File

@ -1203,6 +1203,7 @@ static const char *set_context_by_cmdname(const char *cmd, cmdidx_T cmdidx, cons
case CMD_folddoclosed: case CMD_folddoclosed:
case CMD_folddoopen: case CMD_folddoopen:
case CMD_hide: case CMD_hide:
case CMD_horizontal:
case CMD_keepalt: case CMD_keepalt:
case CMD_keepjumps: case CMD_keepjumps:
case CMD_keepmarks: case CMD_keepmarks:

View File

@ -1757,6 +1757,7 @@ static bool skip_cmd(const exarg_T *eap)
case CMD_filter: case CMD_filter:
case CMD_help: case CMD_help:
case CMD_hide: case CMD_hide:
case CMD_horizontal:
case CMD_ijump: case CMD_ijump:
case CMD_ilist: case CMD_ilist:
case CMD_isearch: case CMD_isearch:

View File

@ -926,6 +926,10 @@ func Test_cmdline_complete_various()
call feedkeys(":all abc\<C-A>\<C-B>\"\<CR>", 'xt') call feedkeys(":all abc\<C-A>\<C-B>\"\<CR>", 'xt')
call assert_equal("\"all abc\<C-A>", @:) call assert_equal("\"all abc\<C-A>", @:)
" completion for :wincmd with :horizontal modifier
call feedkeys(":horizontal wincm\<C-A>\<C-B>\"\<CR>", 'xt')
call assert_equal("\"horizontal wincmd", @:)
" completion for a command with a command modifier " completion for a command with a command modifier
call feedkeys(":topleft new\<C-A>\<C-B>\"\<CR>", 'xt') call feedkeys(":topleft new\<C-A>\<C-B>\"\<CR>", 'xt')
call assert_equal("\"topleft new", @:) call assert_equal("\"topleft new", @:)

View File

@ -101,6 +101,10 @@ function Test_cmdmods()
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)
horizontal MyCmd
call assert_equal('horizontal', g:mods)
hor MyCmd
call assert_equal('horizontal', g:mods)
aboveleft belowright botright browse confirm hide keepalt keepjumps aboveleft belowright botright browse confirm hide keepalt keepjumps
\ keepmarks keeppatterns lockmarks noautocmd noswapfile silent \ keepmarks keeppatterns lockmarks noautocmd noswapfile silent

View File

@ -1247,6 +1247,10 @@ size_t add_win_cmd_modifers(char *buf, const cmdmod_T *cmod, bool *multi_mods)
if (cmod->cmod_split & WSP_VERT) { if (cmod->cmod_split & WSP_VERT) {
result += add_cmd_modifier(buf, "vertical", multi_mods); result += add_cmd_modifier(buf, "vertical", multi_mods);
} }
// :horizontal
if (cmod->cmod_split & WSP_HOR) {
result += add_cmd_modifier(buf, "horizontal", multi_mods);
}
return result; return result;
} }