From 194d18586c41b4c4d5cb9fbf03a10d4a7945a55e Mon Sep 17 00:00:00 2001
From: David Lawrence Ramsey <pooka109@gmail.com>
Date: Thu, 10 Jan 2019 12:18:51 -0600
Subject: [PATCH] input: properly handle <Escape>s followed by a shifted
 Meta+letter

After a series of escapes, also <Shift+Meta+letter> should be recognized
as a command keystroke, not just <Meta+letter>.

This fixes https://savannah.gnu.org/bugs/?55442.

Bug existed since the ignoring of <Escape>s before a valid command
keystroke was introduced in version 3.0, commit ecc9211a.
---
 src/winio.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/winio.c b/src/winio.c
index e2042d9e..7e3d69c0 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -475,7 +475,7 @@ int parse_kbinput(WINDOW *win)
 						 * or control character sequence mode. */
 						if (!solitary) {
 							meta_key = TRUE;
-							retval = keycode;
+							retval = tolower(keycode);
 						} else
 							retval = get_control_kbinput(keycode);
 					else {
@@ -502,8 +502,10 @@ int parse_kbinput(WINDOW *win)
 			break;
 		case 3:
 			if (key_buffer_len == 0) {
-				if (!solitary)
+				if (!solitary) {
 					meta_key = TRUE;
+					retval = tolower(keycode);
+				} else
 				/* Three escapes followed by a non-escape, and no
 				 * other codes are waiting: normal input mode. */
 				retval = keycode;
-- 
GitLab