neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit ff90032aa5e8e943c1934d5a225243be5f1aee53
parent 69f4fd84aaa835f563871c761602c9b5bd5e3842
Author: zeertzjq <zeertzjq@outlook.com>
Date:   Mon,  8 Dec 2025 08:10:22 +0800

vim-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: vim/vim#18859

https://github.com/vim/vim/commit/2b3566d89eeb3f84dad7715fff153b84177e5fbb

Diffstat:
Msrc/nvim/tag.c | 2+-
Mtest/old/testdir/test_tagjump.vim | 5+++++
2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/nvim/tag.c b/src/nvim/tag.c @@ -2869,7 +2869,7 @@ static int jumpto_tag(const char *lbuf_arg, int forceit, bool keep_help) cmdmod.cmod_split |= WSP_VERT; } - if (swb_flags & kOptSwbFlagNewtab) { + if ((swb_flags & kOptSwbFlagNewtab) && cmdmod.cmod_tab == 0) { // If 'switchbuf' contains 'newtab', then use a new tabpage cmdmod.cmod_tab = tabpage_index(curtab) + 1; } diff --git a/test/old/testdir/test_tagjump.vim b/test/old/testdir/test_tagjump.vim @@ -163,8 +163,13 @@ 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& set switchbuf&vim