summaryrefslogtreecommitdiff
path: root/src/term.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/term.c')
-rw-r--r--src/term.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/term.c b/src/term.c
index d7cece383..c90efe530 100644
--- a/src/term.c
+++ b/src/term.c
@@ -5349,6 +5349,11 @@ handle_key_with_modifier(
if ((modifiers & MOD_MASK_SHIFT) && key >= 'a' && key <= 'z')
key += 'A' - 'a';
+ // Putting Esc in the buffer creates ambiguity, it can be the start of an
+ // escape sequence. Use K_ESC to avoid that.
+ if (key == ESC)
+ key = K_ESC;
+
return put_key_modifiers_in_typebuf(key, modifiers,
csi_len, offset, buf, bufsize, buflen);
}