]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1961: :0tab behaves like :tab for :stag when 'swb' contains "newtab" v9.1.1961
authorzeertzjq <zeertzjq@outlook.com>
Sun, 7 Dec 2025 18:07:37 +0000 (19:07 +0100)
committerChristian Brabandt <cb@256bit.org>
Sun, 7 Dec 2025 18:07:37 +0000 (19:07 +0100)
Problem:  :0tab behaves like :tab for :stag when 'switchbuf' contains
          "newtab" (after 9.1.1949).
Solution: Don't override cmod_tab if it's already non-zero (zeertzjq).

closes: #18859

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/tag.c
src/testdir/test_tagjump.vim
src/version.c

index 60b38d156d2fb66e60123c3b959576e1cba073d7..78d2902770aa52d85fc2e14e71a734db2b612c08 100644 (file)
--- a/src/tag.c
+++ b/src/tag.c
@@ -3855,7 +3855,7 @@ jumpto_tag(
            // split window.
            cmdmod.cmod_split |= WSP_VERT;
 
-       if (swb_flags & SWB_NEWTAB)
+       if ((swb_flags & SWB_NEWTAB) && cmdmod.cmod_tab == 0)
            // If 'switchbuf' contains 'newtab', then use a new tabpage
            cmdmod.cmod_tab = tabpage_index(curtab) + 1;
 
index 2e8a5ac9d3441c80f2a8ff3fc694c912bdd06729..bbab3c70e8b1ce39ef371a42b5d94d55d07171c4 100644 (file)
@@ -162,7 +162,12 @@ func Test_tagjump_switchbuf()
   call assert_equal(2, tabpagenr('$'))
   call assert_equal(2, tabpagenr())
   call assert_equal(2, line('.'))
+  0tab stag third
+  call assert_equal(3, tabpagenr('$'))
+  call assert_equal(1, tabpagenr())
+  call assert_equal(3, line('.'))
 
+  tabclose!
   tabclose!
   enew | only
   set tags&
index ba74665b5afd5452c186b58afd2b2f64905a41b1..9a747725394093390b16ca293a9e3e0303683983 100644 (file)
@@ -729,6 +729,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1961,
 /**/
     1960,
 /**/