To: vim_dev@googlegroups.com Subject: Patch 8.0.1119 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1119 Problem: Quitting a split terminal window kills the job. (Yasuhiro Matsumoto) Solution: Only stop terminal job if it is the last window. Files: src/buffer.c, src/testdir/test_terminal.vim *** ../vim-8.0.1118/src/buffer.c 2017-09-16 20:54:47.086560482 +0200 --- src/buffer.c 2017-09-17 19:03:48.433938340 +0200 *************** *** 466,473 **** int del_buf = (action == DOBUF_DEL || action == DOBUF_WIPE); int wipe_buf = (action == DOBUF_WIPE); #ifdef FEAT_TERMINAL ! if (bt_terminal(buf)) { if (term_job_running(buf->b_term)) { --- 466,492 ---- 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) && (buf->b_nwindows == 1 || del_buf)) { if (term_job_running(buf->b_term)) { *************** *** 489,514 **** 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 --- 508,514 ---- *** ../vim-8.0.1118/src/testdir/test_terminal.vim 2017-09-16 17:42:37.443279300 +0200 --- src/testdir/test_terminal.vim 2017-09-17 19:06:55.516835648 +0200 *************** *** 82,87 **** --- 82,104 ---- 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 *** ../vim-8.0.1118/src/version.c 2017-09-16 20:54:47.122560269 +0200 --- src/version.c 2017-09-17 18:51:49.642212786 +0200 *************** *** 763,764 **** --- 763,766 ---- { /* Add new patch number below this line */ + /**/ + 1119, /**/ -- hundred-and-one symptoms of being an internet addict: 141. You'd rather go to http://www.weather.com/ than look out your window. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///