From 2cd0f27b75c4497bec872819a965b3d6b4d55030 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 4 Oct 2022 20:14:28 +0100 Subject: [PATCH] patch 9.0.0660: mapping with CTRL keys does not work in the GUI Problem: Mapping with CTRL keys does not work in the GUI. Solution: Recognize CSI next to K_SPECIAL. (closes #11275, closes #11270) --- src/map.c | 6 +++++- src/testdir/test_gui.vim | 19 +++++++++++++++++++ src/version.c | 2 ++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/map.c b/src/map.c index 526ed50c4..e99da373b 100644 --- a/src/map.c +++ b/src/map.c @@ -1753,7 +1753,11 @@ vim_strsave_escape_csi(char_u *p) d = res; for (s = p; *s != NUL; ) { - if (s[0] == K_SPECIAL && s[1] != NUL && s[2] != NUL) + if ((s[0] == K_SPECIAL +#ifdef FEAT_GUI + || (gui.in_use && s[0] == CSI) +#endif + ) && s[1] != NUL && s[2] != NUL) { // Copy special key unmodified. *d++ = *s++; diff --git a/src/testdir/test_gui.vim b/src/testdir/test_gui.vim index 447eee865..8ac0985c3 100644 --- a/src/testdir/test_gui.vim +++ b/src/testdir/test_gui.vim @@ -1732,4 +1732,23 @@ func Test_gui_lowlevel_keyevent() bw! endfunc +func Test_gui_macro_csi() + " Test for issue #11270 + nnoremap let g:triggered = 1 + let @q = "\x9b\xfc\x04L" + norm @q + call assert_equal(1, g:triggered) + unlet g:triggered + nunmap + + " Test for issue #11057 + inoremap t bbb + call setline(1, "\t") + let @q = "i\x9b\xfc\x04D" + " The end of :normal is like a mapping timing out + norm @q + call assert_equal('', getline(1)) + iunmap t +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/src/version.c b/src/version.c index ce0dce07a..3adb51332 100644 --- a/src/version.c +++ b/src/version.c @@ -699,6 +699,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 660, /**/ 659, /**/ -- 2.40.0