summaryrefslogtreecommitdiffstats
path: root/src/getchar.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-11-29 20:33:20 +0000
committerBram Moolenaar <Bram@vim.org>2022-11-29 20:33:20 +0000
commitdffa6ea85c82bbcb60368f38f7437c6cd89c9e55 (patch)
tree3b32e583d7dd097a9e1601ce9dc4b63a45a59362 /src/getchar.c
parent064fd67e6a0283bb24732146fd20c92b6dbf47bf (diff)
patch 9.0.0974: even when Esc is encoded a timeout is usedv9.0.0974
Problem: Even when Esc is encoded a timeout is used. Solution: Use K_ESC when an encoded Esc is found.
Diffstat (limited to 'src/getchar.c')
-rw-r--r--src/getchar.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/getchar.c b/src/getchar.c
index 142e394aa6..3fd518b00d 100644
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -1765,6 +1765,12 @@ vgetc(void)
}
c = TO_SPECIAL(c2, c);
+ // K_ESC is used to avoid ambiguity with the single Esc
+ // character that might be the start of an escape sequence.
+ // Convert it back to a single Esc here.
+ if (c == K_ESC)
+ c = ESC;
+
#if defined(FEAT_GUI_MSWIN) && defined(FEAT_MENU) && defined(FEAT_TEAROFF)
// Handle K_TEAROFF here, the caller of vgetc() doesn't need to
// know that a menu was torn off
@@ -3913,6 +3919,12 @@ getcmdkeycmd(
continue;
}
c1 = TO_SPECIAL(c1, c2);
+
+ // K_ESC is used to avoid ambiguity with the single Esc character
+ // that might be the start of an escape sequence. Convert it back
+ // to a single Esc here.
+ if (c1 == K_ESC)
+ c1 = ESC;
}
if (c1 == Ctrl_V)
{