comparison 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
comparison
equal deleted inserted replaced
27640:72da8327a05e 27641:1bdb36828dcc
1981 1981
1982 func CmdCompl(a, b, c) 1982 func CmdCompl(a, b, c)
1983 return repeat(['aaaa'], 120) 1983 return repeat(['aaaa'], 120)
1984 endfunc 1984 endfunc
1985 command -nargs=* -complete=customlist,CmdCompl Tcmd 1985 command -nargs=* -complete=customlist,CmdCompl Tcmd
1986
1987 func MyStatusLine() abort
1988 return 'status'
1989 endfunc
1990 func SetupStatusline()
1991 set statusline=%!MyStatusLine()
1992 set laststatus=2
1993 endfunc
1986 [CODE] 1994 [CODE]
1987 call writefile(commands, 'Xtest') 1995 call writefile(commands, 'Xtest')
1988 1996
1989 let buf = RunVimInTerminal('-S Xtest', #{rows: 10}) 1997 let buf = RunVimInTerminal('-S Xtest', #{rows: 10})
1990 1998
2164 call term_sendkeys(buf, ":edit foo\<CR>") 2172 call term_sendkeys(buf, ":edit foo\<CR>")
2165 call term_sendkeys(buf, ":edit bar\<CR>") 2173 call term_sendkeys(buf, ":edit bar\<CR>")
2166 call term_sendkeys(buf, ":ls\<CR>") 2174 call term_sendkeys(buf, ":ls\<CR>")
2167 call term_sendkeys(buf, ":com\<Tab> ") 2175 call term_sendkeys(buf, ":com\<Tab> ")
2168 call VerifyScreenDump(buf, 'Test_wildmenu_pum_38', {}) 2176 call VerifyScreenDump(buf, 'Test_wildmenu_pum_38', {})
2177 call term_sendkeys(buf, "\<C-U>\<CR>")
2178
2179 " Esc still works to abort the command when 'statusline' is set
2180 call term_sendkeys(buf, ":call SetupStatusline()\<CR>")
2181 call term_sendkeys(buf, ":si\<Tab>")
2182 call term_sendkeys(buf, "\<Esc>")
2183 call VerifyScreenDump(buf, 'Test_wildmenu_pum_39', {})
2169 2184
2170 call term_sendkeys(buf, "\<C-U>\<CR>") 2185 call term_sendkeys(buf, "\<C-U>\<CR>")
2171 call StopVimInTerminal(buf) 2186 call StopVimInTerminal(buf)
2172 call delete('Xtest') 2187 call delete('Xtest')
2173 call delete('Xdir', 'rf') 2188 call delete('Xdir', 'rf')