diff src/testdir/test_cmdline.vim @ 27641:1bdb36828dcc v8.2.4346

patch 8.2.4346: a custom statusline may cause Esc to work like Enter Commit: https://github.com/vim/vim/commit/481acb11413a436653e235d2098990b2ad47d195 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Feb 11 18:51:45 2022 +0000 patch 8.2.4346: a custom statusline may cause Esc to work like Enter Problem: A custom statusline may cause Esc to work like Enter on the command line when the popup menu is displayed. Solution: Save and restore KeyTyped. (closes #9749)
author Bram Moolenaar <Bram@vim.org>
date Fri, 11 Feb 2022 20:00:03 +0100
parents 9caeb7f8b094
children 38eab98ef5a9
line wrap: on
line diff
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -1983,6 +1983,14 @@ func Test_wildmenu_pum()
       return repeat(['aaaa'], 120)
     endfunc
     command -nargs=* -complete=customlist,CmdCompl Tcmd
+
+    func MyStatusLine() abort
+      return 'status'
+    endfunc
+    func SetupStatusline()
+      set statusline=%!MyStatusLine()
+      set laststatus=2
+    endfunc
   [CODE]
   call writefile(commands, 'Xtest')
 
@@ -2166,6 +2174,13 @@ func Test_wildmenu_pum()
   call term_sendkeys(buf, ":ls\<CR>")
   call term_sendkeys(buf, ":com\<Tab> ")
   call VerifyScreenDump(buf, 'Test_wildmenu_pum_38', {})
+  call term_sendkeys(buf, "\<C-U>\<CR>")
+
+  " Esc still works to abort the command when 'statusline' is set
+  call term_sendkeys(buf, ":call SetupStatusline()\<CR>")
+  call term_sendkeys(buf, ":si\<Tab>")
+  call term_sendkeys(buf, "\<Esc>")
+  call VerifyScreenDump(buf, 'Test_wildmenu_pum_39', {})
 
   call term_sendkeys(buf, "\<C-U>\<CR>")
   call StopVimInTerminal(buf)