diff src/getchar.c @ 31281:cab7d8accab7 v9.0.0974

patch 9.0.0974: even when Esc is encoded a timeout is used Commit: https://github.com/vim/vim/commit/dffa6ea85c82bbcb60368f38f7437c6cd89c9e55 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Nov 29 20:33:20 2022 +0000 patch 9.0.0974: even when Esc is encoded a timeout is used Problem: Even when Esc is encoded a timeout is used. Solution: Use K_ESC when an encoded Esc is found.
author Bram Moolenaar <Bram@vim.org>
date Tue, 29 Nov 2022 21:45:04 +0100
parents ee50174810ac
children e5ee2ffd826a
line wrap: on
line diff
--- 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)
 	{