summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-03-25 16:41:06 +0100
committerChristian Brabandt <cb@256bit.org>2024-03-25 16:41:06 +0100
commit076faac5378cf517baa8c331c57488d39efadec0 (patch)
treea7c0e09d425e3f173bd90167e69d8ba25c80af9d /src
parent6dcf59b89fd4a65df4a68a333a66357c2480d7b0 (diff)
patch 9.1.0205: Cannot use modifiers before :-Ntabmovev9.1.0205
Problem: Cannot use modifiers before :-Ntabmove. Solution: Check backwards from the command instead of checking from the start of the command line. Slightly adjust docs to make them more consistent (zeertzjq). closes: #14289 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src')
-rw-r--r--src/ex_docmd.c16
-rw-r--r--src/testdir/test_tabpage.vim8
-rw-r--r--src/version.c2
3 files changed, 21 insertions, 5 deletions
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 19b1d85c68..21ba0d5bc3 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -6317,11 +6317,19 @@ get_tabpage_arg(exarg_T *eap)
else
{
tab_number = eap->line2;
- if (!unaccept_arg0 && *skipwhite(*eap->cmdlinep) == '-')
+ if (!unaccept_arg0)
{
- --tab_number;
- if (tab_number < unaccept_arg0)
- eap->errmsg = _(e_invalid_range);
+ char_u *cmdp = eap->cmd;
+
+ while (--cmdp > *eap->cmdlinep
+ && (VIM_ISWHITE(*cmdp) || VIM_ISDIGIT(*cmdp)))
+ ;
+ if (*cmdp == '-')
+ {
+ --tab_number;
+ if (tab_number < unaccept_arg0)
+ eap->errmsg = _(e_invalid_range);
+ }
}
}
}
diff --git a/src/testdir/test_tabpage.vim b/src/testdir/test_tabpage.vim
index a531f19334..3624790e3e 100644
--- a/src/testdir/test_tabpage.vim
+++ b/src/testdir/test_tabpage.vim
@@ -117,10 +117,16 @@ function Test_tabpage()
call assert_equal(3, tabpagenr())
+3tabmove
call assert_equal(6, tabpagenr())
+ silent -tabmove
+ call assert_equal(5, tabpagenr())
+ silent -2 tabmove
+ call assert_equal(3, tabpagenr())
+ silent -2 tabmove
+ call assert_equal(1, tabpagenr())
- " The following are a no-op
norm! 2gt
call assert_equal(2, tabpagenr())
+ " The following are a no-op
tabmove 2
call assert_equal(2, tabpagenr())
2tabmove
diff --git a/src/version.c b/src/version.c
index a1b26073f3..5d90323683 100644
--- a/src/version.c
+++ b/src/version.c
@@ -705,6 +705,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 205,
+/**/
204,
/**/
203,