summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-02-14 19:17:53 +0000
committerBram Moolenaar <Bram@vim.org>2022-02-14 19:17:53 +0000
commite4835bf34001471a102528659af009bc46361141 (patch)
tree3031d8fbf6ec1447b52dd20827ae4b89a814f2a0 /src
parent0e76714e901d179a2f020815f07fb375274b5404 (diff)
patch 8.2.4382: a custom 'tabline' may cause Esc to work like Enterv8.2.4382
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 #9776)
Diffstat (limited to 'src')
-rw-r--r--src/drawscreen.c4
-rw-r--r--src/screen.c4
-rw-r--r--src/testdir/dumps/Test_wildmenu_pum_40.dump10
-rw-r--r--src/testdir/test_cmdline.vim15
-rw-r--r--src/version.c2
5 files changed, 31 insertions, 4 deletions
diff --git a/src/drawscreen.c b/src/drawscreen.c
index 69f44a9f93..6cae313fa0 100644
--- a/src/drawscreen.c
+++ b/src/drawscreen.c
@@ -571,7 +571,6 @@ redraw_custom_statusline(win_T *wp)
{
static int entered = FALSE;
int saved_did_emsg = did_emsg;
- int saved_KeyTyped = KeyTyped;
// When called recursively return. This can happen when the statusline
// contains an expression that triggers a redraw.
@@ -592,9 +591,6 @@ redraw_custom_statusline(win_T *wp)
}
did_emsg |= saved_did_emsg;
entered = FALSE;
-
- // A user function may reset KeyTyped, restore it.
- KeyTyped = saved_KeyTyped;
}
#endif
diff --git a/src/screen.c b/src/screen.c
index adcc4b5bab..9010090d79 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -1235,6 +1235,7 @@ win_redr_custom(
int use_sandbox = FALSE;
win_T *ewp;
int p_crb_save;
+ int save_KeyTyped = KeyTyped;
// There is a tiny chance that this gets called recursively: When
// redrawing a status line triggers redrawing the ruler or tabline.
@@ -1394,6 +1395,9 @@ win_redr_custom(
theend:
entered = FALSE;
+
+ // A user function may reset KeyTyped, restore it.
+ KeyTyped = save_KeyTyped;
}
#endif // FEAT_STL_OPT
diff --git a/src/testdir/dumps/Test_wildmenu_pum_40.dump b/src/testdir/dumps/Test_wildmenu_pum_40.dump
new file mode 100644
index 0000000000..75aa01a8aa
--- /dev/null
+++ b/src/testdir/dumps/Test_wildmenu_pum_40.dump
@@ -0,0 +1,10 @@
+|m+1&#ffffff0|y| |t|a|b| |l|i|n|e| @63
+> +0&&@74
+|~+0#4040ff13&| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|~| @73
+|b+3#0000000&|a|r| @71
+| +0&&@74
diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim
index fb1976a19d..76a5c7ca42 100644
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -2107,6 +2107,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')
@@ -2298,6 +2307,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')
diff --git a/src/version.c b/src/version.c
index 3f860002ae..bccf8d9227 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 4382,
+/**/
4381,
/**/
4380,