Permalink
Browse files

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.
  • Loading branch information...
brammool committed Sep 17, 2017
1 parent 4033c55 commit 8adb0d03ca2694922da915356d7ede05e31c5a5c
Showing with 39 additions and 20 deletions.
  1. +20 −20 src/buffer.c
  2. +17 −0 src/testdir/test_terminal.vim
  3. +2 −0 src/version.c
View
@@ -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
View
@@ -761,6 +761,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1119,
/**/
1118,
/**/

0 comments on commit 8adb0d0

Please sign in to comment.