]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.0087: Restoring lastused_tabpage too early in do_arg_all() v9.1.0087
authorglepnir <glephunter@gmail.com>
Fri, 9 Feb 2024 18:30:26 +0000 (19:30 +0100)
committerChristian Brabandt <cb@256bit.org>
Fri, 9 Feb 2024 18:30:26 +0000 (19:30 +0100)
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: #13992

Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/arglist.c
src/testdir/test_tabpage.vim
src/version.c

index 292af30a14a9570f97daad8059fc7338d9098dc0..723133254acd0bdf506672276d67bf6447c6cd05 100644 (file)
@@ -1253,10 +1253,6 @@ do_arg_all(
     // 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)
@@ -1291,6 +1287,11 @@ do_arg_all(
     // to window with first arg
     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);
 
index 46aed221e4053dbecdd885b6c3e963413cb112b3..94f695323fee50751c6d541f3c819ca9da9754e4 100644 (file)
@@ -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!
index 8002c95b6da3266929109897cb897762443c1829..08a78b600113c811de6fc21d039d1a599daa30d2 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    87,
 /**/
     86,
 /**/