# HG changeset patch # User Christian Brabandt # Date 1711381506 -3600 # Node ID ceee63c7f7aab4b20c8bb0f0e2f5b4ad05b301ba # Parent 857eb73fb6a7aca826ae6a3f16a65cac99f52b50 patch 9.1.0205: Cannot use modifiers before :-Ntabmove Commit: https://github.com/vim/vim/commit/076faac5378cf517baa8c331c57488d39efadec0 Author: zeertzjq Date: Mon Mar 25 16:41:06 2024 +0100 patch 9.1.0205: Cannot use modifiers before :-Ntabmove 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 Signed-off-by: Christian Brabandt diff --git a/runtime/doc/tabpage.txt b/runtime/doc/tabpage.txt --- a/runtime/doc/tabpage.txt +++ b/runtime/doc/tabpage.txt @@ -1,4 +1,4 @@ -*tabpage.txt* For Vim version 9.1. Last change: 2022 Feb 02 +*tabpage.txt* For Vim version 9.1. Last change: 2024 Mar 25 VIM REFERENCE MANUAL by Bram Moolenaar @@ -196,7 +196,7 @@ gt *i_CTRL-* *i_ :.tabmove " do nothing :-tabmove " move the tab page to the left :+tabmove " move the tab page to the right - :0tabmove " move the tab page to the beginning of the tab - " list + :0tabmove " move the tab page to the first :tabmove 0 " as above :tabmove " move the tab page to the last :$tabmove " as above diff --git a/src/ex_docmd.c b/src/ex_docmd.c --- 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 --- 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 --- 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,