diff src/testdir/test_cmdline.vim @ 20717:abebcc20af26 v8.2.0911

patch 8.2.0911: crash when opening a buffer for the cmdline window fails Commit: https://github.com/vim/vim/commit/9b7cce28d568f0622d77c6c9878c2d4770c3b164 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jun 6 15:14:08 2020 +0200 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)
author Bram Moolenaar <Bram@vim.org>
date Sat, 06 Jun 2020 15:15:03 +0200
parents ce55e65d7e41
children 0b4a9642b39c
line wrap: on
line diff
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -1183,6 +1183,33 @@ func Test_cmdwin_jump_to_win()
   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