0
0
mirror of https://github.com/vim/vim.git synced 2025-10-11 06:34:16 -04:00

patch 9.1.0611: ambiguous mappings not correctly resolved with modifyOtherKeys

Problem:  ambiguous mappings not correctly resolved with modifyOtherKeys
Solution: Check for termcode when an upper case mapping is received and
          does not match (Oleg Goncharov)

Fix for mapping processing when capital leters are represented with terminal codes.

Problem: there are two mappings and
1) the first mapping is substring of the second,
2) the first non-matching letter is capital,
3) capital letters are represented with termcodes "ESC[27;2;<ascii code>~" in given system
then first mapping is applied instead of second.

Example:

    :map B b
    :map BBB blimp!

and then

    BBB -> bbb

instead of

    BBB -> blimp!

Solution: force termcodes check if capital letter does not match.

closes: #15251

Signed-off-by: Oleg Goncharov <goncharovoi@yandex.ru>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Oleg Goncharov
2024-07-23 20:34:15 +02:00
committed by Christian Brabandt
parent 38ce71c1c3
commit 56904f90d1
4 changed files with 24 additions and 2 deletions

View File

@@ -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;<ascii code>~" control sequences.
if (ASCII_ISUPPER(mp->m_keys[mlen]))
want_termcode = 1;
}
}
}