To: vim_dev@googlegroups.com Subject: Patch 9.0.1472 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ 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, '=== ' . . ' ===')| *** ../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, /**/ -- Girls are like internet domain names, the ones I like are already taken. Well, you can stil get one from a strange country :-P /// Bram Moolenaar -- Bram@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 ///