patch 9.0.0965: using one window for executing autocommands is insufficient
Problem: Using one window for executing autocommands is insufficient.
Solution: Use up to five windows for executing autocommands.
diff --git a/src/globals.h b/src/globals.h
index d9207b9..eadff43 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -977,8 +977,18 @@
EXTERN win_T *curwin; // currently active window
-EXTERN win_T *aucmd_win; // window used in aucmd_prepbuf()
-EXTERN int aucmd_win_used INIT(= FALSE); // aucmd_win is being used
+// When executing autocommands for a buffer that is not in any window, a
+// special window is created to handle the side effects. When autocommands
+// nest we may need more than one. Allow for up to five, if more are needed
+// something crazy is happening.
+#define AUCMD_WIN_COUNT 5
+
+typedef struct {
+ win_T *auc_win; // window used in aucmd_prepbuf()
+ int auc_win_used; // this auc_win is being used
+} aucmdwin_T;
+
+EXTERN aucmdwin_T aucmd_win[AUCMD_WIN_COUNT];
#ifdef FEAT_PROP_POPUP
EXTERN win_T *first_popupwin; // first global popup window