aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-04-21 09:02:30 +0800
committerGitHub <noreply@github.com>2023-04-21 09:02:30 +0800
commitf1b415b3abbcccb8b0d2aa1a41a45dd52de1a5ff (patch)
tree00538aab2ab8fa4c5d4045256b0a504f25a14851 /src
parentc4fb418626187066f213b2cc5cdfe728a40f1fed (diff)
downloadrneovim-f1b415b3abbcccb8b0d2aa1a41a45dd52de1a5ff.tar.gz
rneovim-f1b415b3abbcccb8b0d2aa1a41a45dd52de1a5ff.tar.bz2
rneovim-f1b415b3abbcccb8b0d2aa1a41a45dd52de1a5ff.zip
vim-patch:9.0.1472: ":drop fname" may change the last used tab page (#23230)
Problem: ":drop fname" may change the last used tab page. Solution: Restore the last used tab page when :drop has changed it. (closes vim/vim#12087) https://github.com/vim/vim/commit/8281a16efc76197f7b0b2a385dffb44fce66d33e Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'src')
-rw-r--r--src/nvim/arglist.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/nvim/arglist.c b/src/nvim/arglist.c
index 6735371576..6e3fc62c5b 100644
--- a/src/nvim/arglist.c
+++ b/src/nvim/arglist.c
@@ -1071,6 +1071,8 @@ static void do_arg_all(int count, int forceit, int keep_tabs)
aall.alist->al_refcount++;
arglist_locked = true;
+ tabpage_T *const 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.
@@ -1078,6 +1080,11 @@ 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) {