mirror of
https://github.com/neovim/neovim.git
synced 2025-10-05 09:26:30 +00:00
feat(aucmd_win): allow crazy things with hidden buffers (#21250)
Problem: Crash when doing crazy things with hidden buffers. Solution: Dynamically allocate the list of autocommand windows.
This commit is contained in:
@@ -422,19 +422,18 @@ EXTERN win_T *prevwin INIT(= NULL); // previous window
|
||||
|
||||
EXTERN win_T *curwin; // currently active window
|
||||
|
||||
/// 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.
|
||||
enum { AUCMD_WIN_COUNT = 5, };
|
||||
|
||||
typedef struct {
|
||||
win_T *auc_win; ///< Window used in aucmd_prepbuf(). When not NULL the
|
||||
///< window has been allocated.
|
||||
bool auc_win_used; ///< This auc_win is being used.
|
||||
} aucmdwin_T;
|
||||
|
||||
EXTERN aucmdwin_T aucmd_win[AUCMD_WIN_COUNT];
|
||||
/// 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.
|
||||
EXTERN kvec_t(aucmdwin_T) aucmd_win_vec INIT(= KV_INITIAL_VALUE);
|
||||
#define aucmd_win (aucmd_win_vec.items)
|
||||
#define AUCMD_WIN_COUNT ((int)aucmd_win_vec.size)
|
||||
|
||||
// The window layout is kept in a tree of frames. topframe points to the top
|
||||
// of the tree.
|
||||
|
Reference in New Issue
Block a user