patch 8.2.0911: crash when opening a buffer for the cmdline window fails
Problem: Crash when opening a buffer for the cmdline window fails. (Chris
Barber)
Solution: Check do_ecmd() succeeds. Reset got_int if "q" was used at the
more prompt. (closes #6211)
diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim
index 66f6e90..b5e316c 100644
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -1183,6 +1183,33 @@
call assert_equal(1, winnr('$'))
endfunc
+func Test_cmdwin_interrupted()
+ CheckScreendump
+
+ " aborting the :smile output caused the cmdline window to use the current
+ " buffer.
+ let lines =<< trim [SCRIPT]
+ au WinNew * smile
+ [SCRIPT]
+ call writefile(lines, 'XTest_cmdwin')
+
+ let buf = RunVimInTerminal('-S XTest_cmdwin', {'rows': 18})
+ call TermWait(buf, 1000)
+ " open cmdwin
+ call term_sendkeys(buf, "q:")
+ call TermWait(buf, 500)
+ " quit more prompt for :smile command
+ call term_sendkeys(buf, "q")
+ call TermWait(buf, 500)
+ " execute a simple command
+ call term_sendkeys(buf, "aecho 'done'\<CR>")
+ call VerifyScreenDump(buf, 'Test_cmdwin_interrupted', {})
+
+ " clean up
+ call StopVimInTerminal(buf)
+ call delete('XTest_cmdwin')
+endfunc
+
" Test for backtick expression in the command line
func Test_cmd_backtick()
%argd