summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-09-01 12:58:52 +0100
committerBram Moolenaar <Bram@vim.org>2022-09-01 12:58:52 +0100
commitd3de178e5352fedf0f30b979f46a2fcbca24ea40 (patch)
treea9bf6b52c8a69cd45d2e16c16265a89e7f5b1bf8
parentd83392a43a48c566c0f3b76382a3648584dae32b (diff)
downloadvim-git-d3de178e5352fedf0f30b979f46a2fcbca24ea40.tar.gz
patch 9.0.0346: :horizontal modifier not fully supportedv9.0.0346
Problem: :horizontal modifier not fully supported. Solution: Also use :horizontal for completion and user commands. (closes #11025)
-rw-r--r--runtime/doc/map.txt10
-rw-r--r--src/cmdexpand.c1
-rw-r--r--src/ex_docmd.c1
-rw-r--r--src/testdir/test_cmdline.vim4
-rw-r--r--src/testdir/test_usercommands.vim4
-rw-r--r--src/usercmd.c3
-rw-r--r--src/version.c2
7 files changed, 20 insertions, 5 deletions
diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt
index 69557d614..6beae6ee2 100644
--- a/runtime/doc/map.txt
+++ b/runtime/doc/map.txt
@@ -1724,11 +1724,11 @@ The valid escape sequences are
*<mods>* *<q-mods>* *:command-modifiers*
<mods> The command modifiers, if specified. Otherwise, expands to
nothing. Supported modifiers are |:aboveleft|, |:belowright|,
- |:botright|, |:browse|, |:confirm|, |:hide|, |:keepalt|,
- |:keepjumps|, |:keepmarks|, |:keeppatterns|, |:leftabove|,
- |:lockmarks|, |:noautocmd|, |:noswapfile| |:rightbelow|,
- |:sandbox|, |:silent|, |:tab|, |:topleft|, |:unsilent|,
- |:verbose|, and |:vertical|.
+ |:botright|, |:browse|, |:confirm|, |:hide|, |:horizontal|,
+ |:keepalt|, |:keepjumps|, |:keepmarks|, |:keeppatterns|,
+ |:leftabove|, |:lockmarks|, |:noautocmd|, |:noswapfile|
+ |:rightbelow|, |:sandbox|, |:silent|, |:tab|, |:topleft|,
+ |:unsilent|, |:verbose|, and |:vertical|.
Note that |:filter| is not supported.
Examples: >
command! -nargs=+ -complete=file MyEdit
diff --git a/src/cmdexpand.c b/src/cmdexpand.c
index 5cdb1beab..bfa30533b 100644
--- a/src/cmdexpand.c
+++ b/src/cmdexpand.c
@@ -1776,6 +1776,7 @@ set_context_by_cmdname(
case CMD_folddoclosed:
case CMD_folddoopen:
case CMD_hide:
+ case CMD_horizontal:
case CMD_keepalt:
case CMD_keepjumps:
case CMD_keepmarks:
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 681ab2ca2..9f7875f5e 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -2455,6 +2455,7 @@ do_one_cmd(
case CMD_final:
case CMD_help:
case CMD_hide:
+ case CMD_horizontal:
case CMD_ijump:
case CMD_ilist:
case CMD_isearch:
diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim
index 95db663bd..bec0f5fdf 100644
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -1078,6 +1078,10 @@ func Test_cmdline_complete_various()
call feedkeys(":all abc\<C-A>\<C-B>\"\<CR>", 'xt')
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
call feedkeys(":topleft new\<C-A>\<C-B>\"\<CR>", 'xt')
call assert_equal("\"topleft new", @:)
diff --git a/src/testdir/test_usercommands.vim b/src/testdir/test_usercommands.vim
index 9c75a9197..91d8bfd06 100644
--- a/src/testdir/test_usercommands.vim
+++ b/src/testdir/test_usercommands.vim
@@ -103,6 +103,10 @@ function Test_cmdmods()
call assert_equal('vertical', g:mods)
vert MyCmd
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
\ keepmarks keeppatterns lockmarks noautocmd noswapfile silent
diff --git a/src/usercmd.c b/src/usercmd.c
index 71135119e..6b3eadc93 100644
--- a/src/usercmd.c
+++ b/src/usercmd.c
@@ -1443,6 +1443,9 @@ add_win_cmd_modifers(char_u *buf, cmdmod_T *cmod, int *multi_mods)
// :vertical
if (cmod->cmod_split & WSP_VERT)
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;
}
diff --git a/src/version.c b/src/version.c
index 0e4634798..f6cdb1c5b 100644
--- a/src/version.c
+++ b/src/version.c
@@ -708,6 +708,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 346,
+/**/
345,
/**/
344,