@@ -45,7 +45,7 @@ static int leave_tabpage(buf_T *new_curbuf, int trigger_leave_autocmds);
4545static void enter_tabpage (tabpage_T * tp , buf_T * old_curbuf , int trigger_enter_autocmds , int trigger_leave_autocmds );
4646static void frame_fix_height (win_T * wp );
4747static int frame_minheight (frame_T * topfrp , win_T * next_curwin );
48- static void win_enter_ext (win_T * wp , int undo_sync , int no_curwin , int trigger_enter_autocmds , int trigger_leave_autocmds );
48+ static void win_enter_ext (win_T * wp , int undo_sync , int no_curwin , int trigger_new_autocmds , int trigger_enter_autocmds , int trigger_leave_autocmds );
4949static void win_free (win_T * wp , tabpage_T * tp );
5050static void frame_append (frame_T * after , frame_T * frp );
5151static void frame_insert (frame_T * before , frame_T * frp );
@@ -1259,7 +1259,7 @@ win_split_ins(
12591259 /*
12601260 * make the new window the current window
12611261 */
1262- win_enter (wp , FALSE);
1262+ win_enter_ext (wp , FALSE, FALSE, TRUE, TRUE, TRUE );
12631263 if (flags & WSP_VERT )
12641264 p_wiw = i ;
12651265 else
@@ -2416,7 +2416,7 @@ win_close(win_T *win, int free_buf)
24162416 win_comp_pos ();
24172417 if (close_curwin )
24182418 {
2419- win_enter_ext (wp , FALSE, TRUE, TRUE, TRUE);
2419+ win_enter_ext (wp , FALSE, TRUE, FALSE, TRUE, TRUE);
24202420#ifdef FEAT_AUTOCMD
24212421 if (other_buffer )
24222422 /* careful: after this wp and win may be invalid! */
@@ -3629,7 +3629,9 @@ win_new_tabpage(int after)
36293629
36303630 redraw_all_later (CLEAR );
36313631#ifdef FEAT_AUTOCMD
3632+ apply_autocmds (EVENT_WINNEW , NULL , NULL , FALSE, curbuf );
36323633 apply_autocmds (EVENT_WINENTER , NULL , NULL , FALSE, curbuf );
3634+ apply_autocmds (EVENT_TABNEW , NULL , NULL , FALSE, curbuf );
36333635 apply_autocmds (EVENT_TABENTER , NULL , NULL , FALSE, curbuf );
36343636#endif
36353637 return OK ;
@@ -3808,7 +3810,7 @@ enter_tabpage(
38083810 /* We would like doing the TabEnter event first, but we don't have a
38093811 * valid current window yet, which may break some commands.
38103812 * This triggers autocommands, thus may make "tp" invalid. */
3811- win_enter_ext (tp -> tp_curwin , FALSE, TRUE,
3813+ win_enter_ext (tp -> tp_curwin , FALSE, TRUE, FALSE,
38123814 trigger_enter_autocmds , trigger_leave_autocmds );
38133815 prevwin = next_prevwin ;
38143816
@@ -4242,7 +4244,7 @@ win_goto_hor(
42424244 void
42434245win_enter (win_T * wp , int undo_sync )
42444246{
4245- win_enter_ext (wp , undo_sync , FALSE, TRUE, TRUE);
4247+ win_enter_ext (wp , undo_sync , FALSE, FALSE, TRUE, TRUE);
42464248}
42474249
42484250/*
@@ -4255,6 +4257,7 @@ win_enter_ext(
42554257 win_T * wp ,
42564258 int undo_sync ,
42574259 int curwin_invalid ,
4260+ int trigger_new_autocmds UNUSED ,
42584261 int trigger_enter_autocmds UNUSED ,
42594262 int trigger_leave_autocmds UNUSED )
42604263{
@@ -4340,6 +4343,8 @@ win_enter_ext(
43404343 }
43414344
43424345#ifdef FEAT_AUTOCMD
4346+ if (trigger_new_autocmds )
4347+ apply_autocmds (EVENT_WINNEW , NULL , NULL , FALSE, curbuf );
43434348 if (trigger_enter_autocmds )
43444349 {
43454350 apply_autocmds (EVENT_WINENTER , NULL , NULL , FALSE, curbuf );
0 commit comments