1
0
forked from aniani/vim

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.
This commit is contained in:
Bram Moolenaar
2018-03-10 20:28:12 +01:00
parent b5b7562475
commit 25cdd9c33b
10 changed files with 225 additions and 39 deletions

View File

@@ -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_sequence()
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