patch 8.0.1612: need to close terminal after shell stopped
Problem: Need to close terminal after shell stopped.
Solution: Make :terminal without argument close the window by default.
diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim
index 9ac0f27..58737ed 100644
--- a/src/testdir/test_terminal.vim
+++ b/src/testdir/test_terminal.vim
@@ -367,6 +367,26 @@
let [cmd, waittime] = s:get_sleep_cmd()
+ " shell terminal closes automatically
+ terminal
+ let buf = bufnr('%')
+ call assert_equal(2, winnr('$'))
+ " Wait for the shell to display a prompt
+ call WaitFor({-> term_getline(buf, 1) != ""})
+ call Stop_shell_in_terminal(buf)
+ call WaitFor("winnr('$') == 1", waittime)
+
+ " shell terminal that does not close automatically
+ terminal ++noclose
+ let buf = bufnr('%')
+ call assert_equal(2, winnr('$'))
+ " Wait for the shell to display a prompt
+ call WaitFor({-> term_getline(buf, 1) != ""})
+ call Stop_shell_in_terminal(buf)
+ call assert_equal(2, winnr('$'))
+ quit
+ call assert_equal(1, winnr('$'))
+
exe 'terminal ++close ' . cmd
call assert_equal(2, winnr('$'))
wincmd p