mirror of
https://github.com/neovim/neovim.git
synced 2024-12-20 03:05:11 -07:00
vim-patch:8.2.4382: a custom 'tabline' may cause Esc to work like Enter
Problem: A custom 'tabline' 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#9776)
e4835bf340
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
parent
ef77598bfb
commit
81473c8ab2
@ -268,6 +268,7 @@ static void win_redr_custom(win_T *wp, bool draw_winbar, bool draw_ruler)
|
||||
StlClickRecord *tabtab;
|
||||
win_T *ewp;
|
||||
int p_crb_save;
|
||||
bool save_KeyTyped = KeyTyped;
|
||||
bool is_stl_global = global_stl_height() > 0;
|
||||
|
||||
ScreenGrid *grid = &default_grid;
|
||||
@ -422,6 +423,9 @@ static void win_redr_custom(win_T *wp, bool draw_winbar, bool draw_ruler)
|
||||
|
||||
theend:
|
||||
entered = false;
|
||||
|
||||
// A user function may reset KeyTyped, restore it.
|
||||
KeyTyped = save_KeyTyped;
|
||||
}
|
||||
|
||||
void win_redr_winbar(win_T *wp)
|
||||
@ -639,7 +643,6 @@ int fillchar_status(int *attr, win_T *wp)
|
||||
void redraw_custom_statusline(win_T *wp)
|
||||
{
|
||||
static bool entered = false;
|
||||
bool saved_KeyTyped = KeyTyped;
|
||||
|
||||
// When called recursively return. This can happen when the statusline
|
||||
// contains an expression that triggers a redraw.
|
||||
@ -650,9 +653,6 @@ void redraw_custom_statusline(win_T *wp)
|
||||
|
||||
win_redr_custom(wp, false, false);
|
||||
entered = false;
|
||||
|
||||
// A user function may reset KeyTyped, restore it.
|
||||
KeyTyped = saved_KeyTyped;
|
||||
}
|
||||
|
||||
static void ui_ext_tabline_update(void)
|
||||
|
@ -2312,6 +2312,15 @@ func Test_wildmenu_pum()
|
||||
set statusline=%!MyStatusLine()
|
||||
set laststatus=2
|
||||
endfunc
|
||||
|
||||
func MyTabLine()
|
||||
return 'my tab line'
|
||||
endfunc
|
||||
func SetupTabline()
|
||||
set statusline=
|
||||
set tabline=%!MyTabLine()
|
||||
set showtabline=2
|
||||
endfunc
|
||||
[CODE]
|
||||
call writefile(commands, 'Xtest')
|
||||
|
||||
@ -2503,6 +2512,12 @@ func Test_wildmenu_pum()
|
||||
call term_sendkeys(buf, "\<Esc>")
|
||||
call VerifyScreenDump(buf, 'Test_wildmenu_pum_39', {})
|
||||
|
||||
" Esc still works to abort the command when 'tabline' is set
|
||||
call term_sendkeys(buf, ":call SetupTabline()\<CR>")
|
||||
call term_sendkeys(buf, ":si\<Tab>")
|
||||
call term_sendkeys(buf, "\<Esc>")
|
||||
call VerifyScreenDump(buf, 'Test_wildmenu_pum_40', {})
|
||||
|
||||
call term_sendkeys(buf, "\<C-U>\<CR>")
|
||||
call StopVimInTerminal(buf)
|
||||
call delete('Xtest')
|
||||
|
Loading…
Reference in New Issue
Block a user