File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -466,8 +466,27 @@ close_buffer(
466466 int del_buf = (action == DOBUF_DEL || action == DOBUF_WIPE );
467467 int wipe_buf = (action == DOBUF_WIPE );
468468
469+ /*
470+ * Force unloading or deleting when 'bufhidden' says so.
471+ * The caller must take care of NOT deleting/freeing when 'bufhidden' is
472+ * "hide" (otherwise we could never free or delete a buffer).
473+ */
474+ if (buf -> b_p_bh [0 ] == 'd' ) /* 'bufhidden' == "delete" */
475+ {
476+ del_buf = TRUE;
477+ unload_buf = TRUE;
478+ }
479+ else if (buf -> b_p_bh [0 ] == 'w' ) /* 'bufhidden' == "wipe" */
480+ {
481+ del_buf = TRUE;
482+ unload_buf = TRUE;
483+ wipe_buf = TRUE;
484+ }
485+ else if (buf -> b_p_bh [0 ] == 'u' ) /* 'bufhidden' == "unload" */
486+ unload_buf = TRUE;
487+
469488#ifdef FEAT_TERMINAL
470- if (bt_terminal (buf ))
489+ if (bt_terminal (buf ) && ( buf -> b_nwindows == 1 || del_buf ) )
471490 {
472491 if (term_job_running (buf -> b_term ))
473492 {
@@ -489,26 +508,7 @@ close_buffer(
489508 wipe_buf = TRUE;
490509 }
491510 }
492- else
493511#endif
494- /*
495- * Force unloading or deleting when 'bufhidden' says so.
496- * The caller must take care of NOT deleting/freeing when 'bufhidden' is
497- * "hide" (otherwise we could never free or delete a buffer).
498- */
499- if (buf -> b_p_bh [0 ] == 'd' ) /* 'bufhidden' == "delete" */
500- {
501- del_buf = TRUE;
502- unload_buf = TRUE;
503- }
504- else if (buf -> b_p_bh [0 ] == 'w' ) /* 'bufhidden' == "wipe" */
505- {
506- del_buf = TRUE;
507- unload_buf = TRUE;
508- wipe_buf = TRUE;
509- }
510- else if (buf -> b_p_bh [0 ] == 'u' ) /* 'bufhidden' == "unload" */
511- unload_buf = TRUE;
512512
513513#ifdef FEAT_AUTOCMD
514514 /* Disallow deleting the buffer when it is locked (already being closed or
Original file line number Diff line number Diff line change @@ -82,6 +82,23 @@ func Test_terminal_wipe_buffer()
8282 unlet g: job
8383endfunc
8484
85+ func Test_terminal_split_quit ()
86+ let buf = Run_shell_in_terminal ({})
87+ call term_wait (buf )
88+ split
89+ quit !
90+ call term_wait (buf )
91+ sleep 50 m
92+ call assert_equal (' run' , job_status (g: job ))
93+
94+ quit !
95+ call WaitFor (' job_status(g:job) == "dead"' )
96+ call assert_equal (' dead' , job_status (g: job ))
97+
98+ exe buf . ' bwipe'
99+ unlet g: job
100+ endfunc
101+
85102func Test_terminal_hide_buffer ()
86103 let buf = Run_shell_in_terminal ({})
87104 setlocal bufhidden = hide
Original file line number Diff line number Diff line change @@ -761,6 +761,8 @@ static char *(features[]) =
761761
762762static int included_patches [] =
763763{ /* Add new patch number below this line */
764+ /**/
765+ 1119 ,
764766/**/
765767 1118 ,
766768/**/
You can’t perform that action at this time.
0 commit comments