diff --git a/src/getchar.c b/src/getchar.c index df89f4cd2f..4af176978c 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -2935,8 +2935,11 @@ handle_mapping( } } else + { // No match; may have to check for termcode at next - // character. If the first character that didn't match is + // character. + + // If the first character that didn't match is // K_SPECIAL then check for a termcode. This isn't perfect // but should work in most cases. if (max_mlen < mlen) @@ -2946,6 +2949,12 @@ handle_mapping( } else if (max_mlen == mlen && mp->m_keys[mlen] == K_SPECIAL) want_termcode = 1; + + // Check termcode for uppercase character to properly + // process "ESC[27;2;~" control sequences. + if (ASCII_ISUPPER(mp->m_keys[mlen])) + want_termcode = 1; + } } } diff --git a/src/testdir/test_termcodes.vim b/src/testdir/test_termcodes.vim index 7e450d998d..507753c21a 100644 --- a/src/testdir/test_termcodes.vim +++ b/src/testdir/test_termcodes.vim @@ -2256,6 +2256,17 @@ func Test_modifyOtherKeys_mapped() iunmap ' iunmap + + " clean buffer + %d _ + imap B b + imap BBB blimp + let input = repeat(GetEscCodeCSI27('B', 2), 3) + call feedkeys("a" .. input .. "\", 'Lx!') + call assert_equal('blimp', getline(1)) + " cleanup + iunmap BBB + iunmap B set timeoutlen& endfunc diff --git a/src/testdir/view_util.vim b/src/testdir/view_util.vim index 71cb071ab7..161c8b20cd 100644 --- a/src/testdir/view_util.vim +++ b/src/testdir/view_util.vim @@ -71,7 +71,7 @@ endfunc " than the raw code. " Return the modifyOtherKeys level 2 encoding for "key" with "modifier" -" (number value, e.g. CTRL is 5). +" (number value, e.g. CTRL is 5, Shift is 2, Alt is 3). func GetEscCodeCSI27(key, modifier) let key = printf("%d", char2nr(a:key)) let mod = printf("%d", a:modifier) diff --git a/src/version.c b/src/version.c index 91286bb75d..3963996e77 100644 --- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 611, /**/ 610, /**/