]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.0205: Cannot use modifiers before :-Ntabmove v9.1.0205
authorzeertzjq <zeertzjq@outlook.com>
Mon, 25 Mar 2024 15:41:06 +0000 (16:41 +0100)
committerChristian Brabandt <cb@256bit.org>
Mon, 25 Mar 2024 15:41:06 +0000 (16:41 +0100)
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>
runtime/doc/tabpage.txt
src/ex_docmd.c
src/testdir/test_tabpage.vim
src/version.c

index a98fe956f1f75c88025b9f4c5a675cec8abc36bc..a922604c817c28f5667316495c4346bb1cecfbd3 100644 (file)
@@ -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-<PageDown>* *i_<C-PageDown>*
                    :1tabnext   " go to the first tab page
                    :$tabnext   " go to the last tab page
                    :tabnext $  " as above
-                   :tabnext #  " go to the last accessed tab page
+                   :tabnext #  " go to the last accessed tab page
                    :tabnext -  " go to the previous tab page
                    :tabnext -1 " as above
                    :tabnext +  " go to the next tab page
@@ -248,13 +248,12 @@ REORDERING TAB PAGES:
                Move the current tab page to after tab page N.  Use zero to
                make the current tab page the first one.  N is counted before
                the move, thus if the second tab is the current one,
-               `:tabmove 1` and `:tabmove 2`  have no effect.
+               `:tabmove 1` and `:tabmove 2` have no effect.
                Without N the tab page is made the last one. >
                    :.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
index 19b1d85c6868d0e20430c11ad7f706de20aa62b1..21ba0d5bc34d0b6111c8fe34c1997d453a13ae92 100644 (file)
@@ -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);
+               }
            }
        }
     }
index a531f193342dcc4363c71574dca516ee93da9529..3624790e3e24ae64f43ea0c9be8b7583321be288 100644 (file)
@@ -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
index a1b26073f39d42e0683840ce670723524b2e0d75..5d90323683276b0ecbceb5cdef0a21e95f158757 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    205,
 /**/
     204,
 /**/