patch 9.1.1961: :0tab behaves like :tab for :stag when 'swb' contains "newtab"

Commit: 
https://github.com/vim/vim/commit/2b3566d89eeb3f84dad7715fff153b84177e5fbb
Author: zeertzjq <[email protected]>
Date:   Sun Dec 7 19:07:37 2025 +0100

    patch 9.1.1961: :0tab behaves like :tab for :stag when 'swb' contains 
"newtab"
    
    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 <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/src/tag.c b/src/tag.c
index 60b38d156..78d290277 100644
--- 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;
 
diff --git a/src/testdir/test_tagjump.vim b/src/testdir/test_tagjump.vim
index 2e8a5ac9d..bbab3c70e 100644
--- a/src/testdir/test_tagjump.vim
+++ b/src/testdir/test_tagjump.vim
@@ -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&
diff --git a/src/version.c b/src/version.c
index ba74665b5..9a7477253 100644
--- a/src/version.c
+++ b/src/version.c
@@ -729,6 +729,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1961,
 /**/
     1960,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1vSJHk-003aV6-Se%40256bit.org.

Raspunde prin e-mail lui