Mercurial > vim
diff src/testdir/test_terminal.vim @ 13438:33eea5ce5415 v8.0.1593
patch 8.0.1593: :qall never exits with an active terminal window
commit https://github.com/vim/vim/commit/25cdd9c33b21ddbd31321c075873bb225450d2d2
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Mar 10 20:28:12 2018 +0100
patch 8.0.1593: :qall never exits with an active terminal window
Problem: :qall never exits with an active terminal window.
Solution: Add a way to kill a job in a terminal window.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 10 Mar 2018 20:30:04 +0100 |
parents | fa198b71bab2 |
children | 22439cdda382 |
line wrap: on
line diff
--- a/src/testdir/test_terminal.vim +++ b/src/testdir/test_terminal.vim @@ -5,6 +5,7 @@ if !has('terminal') endif source shared.vim +source screendump.vim let s:python = PythonProg() @@ -839,3 +840,48 @@ func Test_terminal_response_to_control_s call delete('Xescape') unlet g:job endfunc + +" Run Vim in a terminal, then start a terminal in that Vim with a kill +" argument, check that :qall works. +func Test_terminal_qall_kill_arg() + if !CanRunVimInTerminal() + return + endif + let buf = RunVimInTerminal('', {}) + + " Open a terminal window and wait for the prompt to appear + call term_sendkeys(buf, ":term ++kill=kill\<CR>") + call WaitFor({-> term_getline(buf, 10) =~ '\[running]'}) + call WaitFor({-> term_getline(buf, 1) !~ '^\s*$'}) + + " make Vim exit, it will kill the shell + call term_sendkeys(buf, "\<C-W>:qall\<CR>") + call WaitFor({-> term_getstatus(buf) == "finished"}) + + " close the terminal window where Vim was running + quit +endfunc + +" Run Vim in a terminal, then start a terminal in that Vim with a kill +" argument, check that :qall works. +func Test_terminal_qall_kill_func() + if !CanRunVimInTerminal() + return + endif + let buf = RunVimInTerminal('', {}) + + " Open a terminal window and wait for the prompt to appear + call term_sendkeys(buf, ":term\<CR>") + call WaitFor({-> term_getline(buf, 10) =~ '\[running]'}) + call WaitFor({-> term_getline(buf, 1) !~ '^\s*$'}) + + " set kill using term_setkill() + call term_sendkeys(buf, "\<C-W>:call term_setkill(bufnr('%'), 'kill')\<CR>") + + " make Vim exit, it will kill the shell + call term_sendkeys(buf, "\<C-W>:qall\<CR>") + call WaitFor({-> term_getstatus(buf) == "finished"}) + + " close the terminal window where Vim was running + quit +endfunc