Patch 9.0.1472
Problem:    ":drop fname" may change the last used tab page.
Solution:   Restore the last used tab page when :drop has changed it.
            (closes #12087)
Files:      src/arglist.c, src/testdir/test_tabpage.vim


*** ../vim-9.0.1471/src/arglist.c       2023-01-02 16:54:48.928860870 +0000
--- src/arglist.c       2023-04-20 18:06:56.761102071 +0100
***************
*** 1240,1245 ****
--- 1240,1247 ----
      need_mouse_correct = TRUE;
  #endif
  
+     tabpage_T *new_lu_tp = curtab;
+ 
      // Try closing all windows that are not in the argument list.
      // Also close windows that are not full width;
      // When 'hidden' or "forceit" set the buffer becomes hidden.
***************
*** 1247,1252 ****
--- 1249,1258 ----
      // 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)
*** ../vim-9.0.1471/src/testdir/test_tabpage.vim        2023-02-27 
17:17:57.750253721 +0000
--- src/testdir/test_tabpage.vim        2023-04-20 18:05:37.696971029 +0100
***************
*** 150,155 ****
--- 150,171 ----
    tabonly!
  endfunc
  
+ func Test_tabpage_drop()
+   edit f1
+   tab split f2
+   tab split f3
+   normal! gt
+   call assert_equal(1, tabpagenr())
+ 
+   tab drop f3
+   call assert_equal(3, tabpagenr())
+   call assert_equal(1, tabpagenr('#'))
+   bwipe!
+   bwipe!
+   bwipe!
+   call assert_equal(1, tabpagenr('$'))
+ endfunc
+ 
  " Test autocommands
  function Test_tabpage_with_autocmd()
    command -nargs=1 -bar C :call add(s:li, '=== ' . <q-args> . ' ===')|<args>
*** ../vim-9.0.1471/src/version.c       2023-04-19 20:28:43.866094432 +0100
--- src/version.c       2023-04-20 17:21:44.515410366 +0100
***************
*** 697,698 ****
--- 697,700 ----
  {   /* Add new patch number below this line */
+ /**/
+     1472,
  /**/

-- 
<Beeth> Girls are like internet domain names,
        the ones I like are already taken.
<honx>  Well, you can stil get one from a strange country :-P

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20230420170926.25FFE1C0787%40moolenaar.net.

Reply via email to