comparison src/testdir/test_terminal.vim @ 18402:527b7084c556 v8.1.2195

patch 8.1.2195: Vim does not exit when the terminal window is last window Commit: https://github.com/vim/vim/commit/4d14bac8e7441368977e81266166f728105a60d4 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Oct 20 21:15:15 2019 +0200 patch 8.1.2195: Vim does not exit when the terminal window is last window Problem: Vim does not exit when closing a terminal window and it is the last window. Solution: Exit Vim if the closed terminal window is the last one. (closes #4539)
author Bram Moolenaar <Bram@vim.org>
date Sun, 20 Oct 2019 21:30:03 +0200
parents 0e9d3a77c624
children 507348b211b4
comparison
equal deleted inserted replaced
18401:d1bb50cdb9ad 18402:527b7084c556
1047 call term_sendkeys(buf, "y") 1047 call term_sendkeys(buf, "y")
1048 call WaitForAssert({-> assert_equal('finished', term_getstatus(buf))}) 1048 call WaitForAssert({-> assert_equal('finished', term_getstatus(buf))})
1049 1049
1050 " close the terminal window where Vim was running 1050 " close the terminal window where Vim was running
1051 quit 1051 quit
1052 endfunc
1053
1054 " Run Vim in a terminal, then start a terminal window with a shell and check
1055 " that Vim exits if it is closed.
1056 func Test_terminal_exit()
1057 CheckRunVimInTerminal
1058
1059 let lines =<< trim END
1060 let winid = win_getid()
1061 help
1062 term
1063 let termid = win_getid()
1064 call win_gotoid(winid)
1065 close
1066 call win_gotoid(termid)
1067 END
1068 call writefile(lines, 'XtermExit')
1069 let buf = RunVimInTerminal('-S XtermExit', #{rows: 10})
1070 let job = term_getjob(buf)
1071 call WaitForAssert({-> assert_equal("run", job_status(job))})
1072
1073 " quit the shell, it will make Vim exit
1074 call term_sendkeys(buf, "exit\<CR>")
1075 call WaitForAssert({-> assert_equal("dead", job_status(job))})
1076
1077 call delete('XtermExit')
1052 endfunc 1078 endfunc
1053 1079
1054 func Test_terminal_open_autocmd() 1080 func Test_terminal_open_autocmd()
1055 augroup repro 1081 augroup repro
1056 au! 1082 au!