0
0
mirror of https://github.com/vim/vim.git synced 2025-09-26 04:04:07 -04:00

patch 8.2.4551: when mapping <Esc> terminal codes are not recognized

Problem:    When mapping <Esc> terminal codes are not recognized.
Solution:   Specifically recognize a mapping with just <Esc> and check for
            terminal codes even though there is no partial mapping.
            (closes #9903)
This commit is contained in:
Bram Moolenaar
2022-03-12 13:48:39 +00:00
parent 5b4f8a0e84
commit bbf84e2737
3 changed files with 24 additions and 1 deletions

View File

@@ -2643,7 +2643,12 @@ handle_mapping(
max_mlen = mlen + 1;
}
if ((mp == NULL || max_mlen > mp_match_len) && keylen != KEYLEN_PART_MAP)
// May check for a terminal code when there is no mapping or only a partial
// mapping. Also check if there is a full mapping with <Esc>, unless timed
// out, since that is nearly always a partial match with a terminal code.
if ((mp == NULL || max_mlen > mp_match_len
|| (mp_match_len == 1 && *mp->m_keys == ESC && !*timedout))
&& keylen != KEYLEN_PART_MAP)
{
int save_keylen = keylen;