diff options
author | Raphael <glephunter@gmail.com> | 2024-02-10 12:21:31 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-10 12:21:31 +0800 |
commit | 7ab003ec790b34803d64e10e4eb463e585d599d0 (patch) | |
tree | e08a3d11226d372b9ac1deb57b13316a12326b97 | |
parent | ba23d109baa5a863886298fa3590e0258873f2bb (diff) | |
download | rneovim-7ab003ec790b34803d64e10e4eb463e585d599d0.tar.gz rneovim-7ab003ec790b34803d64e10e4eb463e585d599d0.tar.bz2 rneovim-7ab003ec790b34803d64e10e4eb463e585d599d0.zip |
vim-patch:9.1.0087: Restoring lastused_tabpage too early in do_arg_all() (#27411)
Problem: Restore lastused_tabpage too early in do_arg_all() function it
will change later in the function.
Solution: Restore lastused_tabpage a bit later, when being done with
tabpages (glepnir)
closes: vim/vim#13992
https://github.com/vim/vim/commit/2975a54f285e5b4bf026c1dc706b5d90777d64e7
-rw-r--r-- | src/nvim/arglist.c | 11 | ||||
-rw-r--r-- | test/old/testdir/test_tabpage.vim | 7 |
2 files changed, 11 insertions, 7 deletions
diff --git a/src/nvim/arglist.c b/src/nvim/arglist.c index e9108f72cc..a02c22deae 100644 --- a/src/nvim/arglist.c +++ b/src/nvim/arglist.c @@ -1093,11 +1093,6 @@ static void do_arg_all(int count, int forceit, int keep_tabs) // When the ":tab" modifier was used do this for all tab pages. arg_all_close_unused_windows(&aall); - // Now set the last used tabpage to where we started. - if (valid_tabpage(new_lu_tp)) { - lastused_tabpage = new_lu_tp; - } - // Open a window for files in the argument list that don't have one. // ARGCOUNT may change while doing this, because of autocommands. if (count > aall.opened_len || count <= 0) { @@ -1134,6 +1129,12 @@ static void do_arg_all(int count, int forceit, int keep_tabs) if (valid_tabpage(aall.new_curtab)) { goto_tabpage_tp(aall.new_curtab, true, true); } + + // Now set the last used tabpage to where we started. + if (valid_tabpage(new_lu_tp)) { + lastused_tabpage = new_lu_tp; + } + if (win_valid(aall.new_curwin)) { win_enter(aall.new_curwin, false); } diff --git a/test/old/testdir/test_tabpage.vim b/test/old/testdir/test_tabpage.vim index d335f3c1ee..adb9e13269 100644 --- a/test/old/testdir/test_tabpage.vim +++ b/test/old/testdir/test_tabpage.vim @@ -156,10 +156,13 @@ func Test_tabpage_drop() tab split f3 normal! gt call assert_equal(1, tabpagenr()) + tab drop f4 + call assert_equal(1, tabpagenr('#')) tab drop f3 - call assert_equal(3, tabpagenr()) - call assert_equal(1, tabpagenr('#')) + call assert_equal(4, tabpagenr()) + call assert_equal(2, tabpagenr('#')) + bwipe! bwipe! bwipe! bwipe! |