Mercurial > vim
comparison src/getchar.c @ 28053:f615d89a5351 v8.2.4551
patch 8.2.4551: when mapping <Esc> terminal codes are not recognized
Commit: https://github.com/vim/vim/commit/bbf84e2737daf3479e059dc7e7da0c50a07a4bf4
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Mar 12 13:48:39 2022 +0000
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)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 12 Mar 2022 15:00:04 +0100 |
parents | ac7db4437368 |
children | b9e8f3674090 |
comparison
equal
deleted
inserted
replaced
28052:ecbf6ee5ba2c | 28053:f615d89a5351 |
---|---|
2641 else if (max_mlen < mlen) | 2641 else if (max_mlen < mlen) |
2642 // no match, may have to check for termcode at next character | 2642 // no match, may have to check for termcode at next character |
2643 max_mlen = mlen + 1; | 2643 max_mlen = mlen + 1; |
2644 } | 2644 } |
2645 | 2645 |
2646 if ((mp == NULL || max_mlen > mp_match_len) && keylen != KEYLEN_PART_MAP) | 2646 // May check for a terminal code when there is no mapping or only a partial |
2647 // mapping. Also check if there is a full mapping with <Esc>, unless timed | |
2648 // out, since that is nearly always a partial match with a terminal code. | |
2649 if ((mp == NULL || max_mlen > mp_match_len | |
2650 || (mp_match_len == 1 && *mp->m_keys == ESC && !*timedout)) | |
2651 && keylen != KEYLEN_PART_MAP) | |
2647 { | 2652 { |
2648 int save_keylen = keylen; | 2653 int save_keylen = keylen; |
2649 | 2654 |
2650 /* | 2655 /* |
2651 * When no matching mapping found or found a non-matching mapping that | 2656 * When no matching mapping found or found a non-matching mapping that |