summaryrefslogtreecommitdiff
path: root/src/term.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/term.c
parent064fd67e6a0283bb24732146fd20c92b6dbf47bf (diff)
downloadvim-git-dffa6ea85c82bbcb60368f38f7437c6cd89c9e55.tar.gz
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/term.c')
-rw-r--r--src/term.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/term.c b/src/term.c
index ba288ae8b..74c461299 100644
--- a/src/term.c
+++ b/src/term.c
@@ -5121,7 +5121,19 @@ handle_key_without_modifier(
int *buflen)
{
char_u string[MAX_KEY_CODE_LEN + 1];
- int new_slen = add_key_to_buf(arg[0], string);
+ int new_slen;
+
+ if (arg[0] == ESC)
+ {
+ // Putting Esc in the buffer creates ambiguity, it can be the start of
+ // an escape sequence. Use K_ESC to avoid that.
+ string[0] = K_SPECIAL;
+ string[1] = KS_EXTRA;
+ string[2] = KE_ESC;
+ new_slen = 3;
+ }
+ else
+ new_slen = add_key_to_buf(arg[0], string);
if (put_string_in_typebuf(offset, csi_len, string, new_slen,
buf, bufsize, buflen) == FAIL)