forked from aniani/vim
patch 9.1.0059: No event triggered before creating a window
Problem: No event is triggered before creating a window. (Sergey Vlasov) Solution: Add the WinNewPre event (Sergey Vlasov) fixes: #10635 closes: #12761 Signed-off-by: Sergey Vlasov <sergey@vlasov.me> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
92e90a1e10
commit
1f47db75fd
14
src/window.c
14
src/window.c
@@ -19,6 +19,7 @@ static void win_exchange(long);
|
||||
static void win_rotate(int, int);
|
||||
static void win_totop(int size, int flags);
|
||||
static void win_equal_rec(win_T *next_curwin, int current, frame_T *topfr, int dir, int col, int row, int width, int height);
|
||||
static void trigger_winnewpre(void);
|
||||
static void trigger_winclosed(win_T *win);
|
||||
static win_T *win_free_mem(win_T *win, int *dirp, tabpage_T *tp);
|
||||
static frame_T *win_altframe(win_T *win, tabpage_T *tp);
|
||||
@@ -955,6 +956,8 @@ win_split_ins(
|
||||
// Do not redraw here, curwin->w_buffer may be invalid.
|
||||
++RedrawingDisabled;
|
||||
|
||||
trigger_winnewpre();
|
||||
|
||||
if (flags & WSP_TOP)
|
||||
oldwin = firstwin;
|
||||
else if (flags & WSP_BOT)
|
||||
@@ -2886,6 +2889,14 @@ win_close(win_T *win, int free_buf)
|
||||
return OK;
|
||||
}
|
||||
|
||||
static void
|
||||
trigger_winnewpre(void)
|
||||
{
|
||||
window_layout_lock();
|
||||
apply_autocmds(EVENT_WINNEWPRE, NULL, NULL, FALSE, NULL);
|
||||
window_layout_unlock();
|
||||
}
|
||||
|
||||
static void
|
||||
trigger_winclosed(win_T *win)
|
||||
{
|
||||
@@ -4477,6 +4488,9 @@ win_new_tabpage(int after)
|
||||
|
||||
newtp->tp_localdir = (tp->tp_localdir == NULL)
|
||||
? NULL : vim_strsave(tp->tp_localdir);
|
||||
|
||||
trigger_winnewpre();
|
||||
|
||||
// Create a new empty window.
|
||||
if (win_alloc_firstwin(tp->tp_curwin) == OK)
|
||||
{
|
||||
|
Reference in New Issue
Block a user