mirror of
https://github.com/neovim/neovim.git
synced 2025-10-10 11:56:30 +00:00
vim-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 vim/vim#9749)
481acb1141
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
@@ -639,6 +639,7 @@ int fillchar_status(int *attr, win_T *wp)
|
|||||||
void redraw_custom_statusline(win_T *wp)
|
void redraw_custom_statusline(win_T *wp)
|
||||||
{
|
{
|
||||||
static bool entered = false;
|
static bool entered = false;
|
||||||
|
bool saved_KeyTyped = KeyTyped;
|
||||||
|
|
||||||
// When called recursively return. This can happen when the statusline
|
// When called recursively return. This can happen when the statusline
|
||||||
// contains an expression that triggers a redraw.
|
// contains an expression that triggers a redraw.
|
||||||
@@ -649,6 +650,9 @@ void redraw_custom_statusline(win_T *wp)
|
|||||||
|
|
||||||
win_redr_custom(wp, false, false);
|
win_redr_custom(wp, false, false);
|
||||||
entered = false;
|
entered = false;
|
||||||
|
|
||||||
|
// A user function may reset KeyTyped, restore it.
|
||||||
|
KeyTyped = saved_KeyTyped;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ui_ext_tabline_update(void)
|
static void ui_ext_tabline_update(void)
|
||||||
|
@@ -2304,6 +2304,14 @@ func Test_wildmenu_pum()
|
|||||||
return repeat(['aaaa'], 120)
|
return repeat(['aaaa'], 120)
|
||||||
endfunc
|
endfunc
|
||||||
command -nargs=* -complete=customlist,CmdCompl Tcmd
|
command -nargs=* -complete=customlist,CmdCompl Tcmd
|
||||||
|
|
||||||
|
func MyStatusLine() abort
|
||||||
|
return 'status'
|
||||||
|
endfunc
|
||||||
|
func SetupStatusline()
|
||||||
|
set statusline=%!MyStatusLine()
|
||||||
|
set laststatus=2
|
||||||
|
endfunc
|
||||||
[CODE]
|
[CODE]
|
||||||
call writefile(commands, 'Xtest')
|
call writefile(commands, 'Xtest')
|
||||||
|
|
||||||
@@ -2487,6 +2495,13 @@ func Test_wildmenu_pum()
|
|||||||
call term_sendkeys(buf, ":ls\<CR>")
|
call term_sendkeys(buf, ":ls\<CR>")
|
||||||
call term_sendkeys(buf, ":com\<Tab> ")
|
call term_sendkeys(buf, ":com\<Tab> ")
|
||||||
call VerifyScreenDump(buf, 'Test_wildmenu_pum_38', {})
|
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 term_sendkeys(buf, "\<C-U>\<CR>")
|
||||||
call StopVimInTerminal(buf)
|
call StopVimInTerminal(buf)
|
||||||
|
Reference in New Issue
Block a user