File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2768,7 +2768,9 @@ do_ecmd(
27682768 did_decrement = close_buffer (oldwin , curbuf ,
27692769 (flags & ECMD_HIDE ) ? 0 : DOBUF_UNLOAD , FALSE, FALSE);
27702770
2771- the_curwin -> w_closing = FALSE;
2771+ // Autocommands may have closed the window.
2772+ if (win_valid (the_curwin ))
2773+ the_curwin -> w_closing = FALSE;
27722774 -- buf -> b_locked ;
27732775
27742776#ifdef FEAT_EVAL
Original file line number Diff line number Diff line change @@ -2726,4 +2726,15 @@ func Test_BufNew_arglocal()
27262726 au ! BufNew
27272727endfunc
27282728
2729+ func Test_autocmd_closes_window ()
2730+ au BufNew ,BufWinLeave * e % e
2731+ file yyy
2732+ au BufNew ,BufWinLeave * ball
2733+ call assert_fails (' n xxx' , ' E143:' )
2734+
2735+ bwipe %
2736+ au ! BufNew
2737+ au ! BufWinLeave
2738+ endfunc
2739+
27292740" vim: shiftwidth = 2 sts = 2 expandtab
Original file line number Diff line number Diff line change @@ -750,6 +750,8 @@ static char *(features[]) =
750750
751751static int included_patches [] =
752752{ /* Add new patch number below this line */
753+ /**/
754+ 2464 ,
753755/**/
754756 2463 ,
755757/**/
You can’t perform that action at this time.
0 commit comments