patch 9.1.1211: TabClosedPre is triggered just before the tab is being freed
Problem: TabClosedPre is triggered just before the tab is being freed,
which limited its functionality.
Solution: Trigger it a bit earlier and also on :tabclose and :tabonly
(Jim Zhou)
closes: #16890
Signed-off-by: Jim Zhou <jimzhouzzy@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 4438834..80ec8a1 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -6536,6 +6536,8 @@
if (window_layout_locked(CMD_tabclose))
return;
+ trigger_tabclosedpre(curtab, TRUE);
+
// First close all the windows but the current one. If that worked then
// close the last window in this tab, that will close it.
if (!ONE_WINDOW)
@@ -6559,6 +6561,8 @@
int done = 0;
win_T *wp;
+ trigger_tabclosedpre(tp, TRUE);
+
// Limit to 1000 windows, autocommands may add a window while we close
// one. OK, so I'm paranoid...
while (++done < 1000)