From bbf84e2737daf3479e059dc7e7da0c50a07a4bf4 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 12 Mar 2022 13:48:39 +0000 Subject: patch 8.2.4551: when mapping terminal codes are not recognized Problem: When mapping terminal codes are not recognized. Solution: Specifically recognize a mapping with just and check for terminal codes even though there is no partial mapping. (closes #9903) --- src/getchar.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/getchar.c') diff --git a/src/getchar.c b/src/getchar.c index 03d6d4d96d..2bc7d9dd16 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -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 , 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; -- cgit v1.2.3