mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.0.1119: quitting a split terminal window kills the job
Problem: Quitting a split terminal window kills the job. (Yasuhiro Matsumoto) Solution: Only stop terminal job if it is the last window.
This commit is contained in:
parent
4033c55eca
commit
8adb0d03ca
40
src/buffer.c
40
src/buffer.c
@ -466,8 +466,27 @@ close_buffer(
|
||||
int del_buf = (action == DOBUF_DEL || action == DOBUF_WIPE);
|
||||
int wipe_buf = (action == DOBUF_WIPE);
|
||||
|
||||
/*
|
||||
* Force unloading or deleting when 'bufhidden' says so.
|
||||
* The caller must take care of NOT deleting/freeing when 'bufhidden' is
|
||||
* "hide" (otherwise we could never free or delete a buffer).
|
||||
*/
|
||||
if (buf->b_p_bh[0] == 'd') /* 'bufhidden' == "delete" */
|
||||
{
|
||||
del_buf = TRUE;
|
||||
unload_buf = TRUE;
|
||||
}
|
||||
else if (buf->b_p_bh[0] == 'w') /* 'bufhidden' == "wipe" */
|
||||
{
|
||||
del_buf = TRUE;
|
||||
unload_buf = TRUE;
|
||||
wipe_buf = TRUE;
|
||||
}
|
||||
else if (buf->b_p_bh[0] == 'u') /* 'bufhidden' == "unload" */
|
||||
unload_buf = TRUE;
|
||||
|
||||
#ifdef FEAT_TERMINAL
|
||||
if (bt_terminal(buf))
|
||||
if (bt_terminal(buf) && (buf->b_nwindows == 1 || del_buf))
|
||||
{
|
||||
if (term_job_running(buf->b_term))
|
||||
{
|
||||
@ -489,26 +508,7 @@ close_buffer(
|
||||
wipe_buf = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
/*
|
||||
* Force unloading or deleting when 'bufhidden' says so.
|
||||
* The caller must take care of NOT deleting/freeing when 'bufhidden' is
|
||||
* "hide" (otherwise we could never free or delete a buffer).
|
||||
*/
|
||||
if (buf->b_p_bh[0] == 'd') /* 'bufhidden' == "delete" */
|
||||
{
|
||||
del_buf = TRUE;
|
||||
unload_buf = TRUE;
|
||||
}
|
||||
else if (buf->b_p_bh[0] == 'w') /* 'bufhidden' == "wipe" */
|
||||
{
|
||||
del_buf = TRUE;
|
||||
unload_buf = TRUE;
|
||||
wipe_buf = TRUE;
|
||||
}
|
||||
else if (buf->b_p_bh[0] == 'u') /* 'bufhidden' == "unload" */
|
||||
unload_buf = TRUE;
|
||||
|
||||
#ifdef FEAT_AUTOCMD
|
||||
/* Disallow deleting the buffer when it is locked (already being closed or
|
||||
|
@ -82,6 +82,23 @@ func Test_terminal_wipe_buffer()
|
||||
unlet g:job
|
||||
endfunc
|
||||
|
||||
func Test_terminal_split_quit()
|
||||
let buf = Run_shell_in_terminal({})
|
||||
call term_wait(buf)
|
||||
split
|
||||
quit!
|
||||
call term_wait(buf)
|
||||
sleep 50m
|
||||
call assert_equal('run', job_status(g:job))
|
||||
|
||||
quit!
|
||||
call WaitFor('job_status(g:job) == "dead"')
|
||||
call assert_equal('dead', job_status(g:job))
|
||||
|
||||
exe buf . 'bwipe'
|
||||
unlet g:job
|
||||
endfunc
|
||||
|
||||
func Test_terminal_hide_buffer()
|
||||
let buf = Run_shell_in_terminal({})
|
||||
setlocal bufhidden=hide
|
||||
|
@ -761,6 +761,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1119,
|
||||
/**/
|
||||
1118,
|
||||
/**/
|
||||
|
Loading…
x
Reference in New Issue
Block a user