From 3cc561e36e1be7f9199861dfad43bc6f576cb7d0 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Sat, 26 Nov 2016 12:25:36 +0100
Subject: [PATCH] input: distinguish <Shift+Home> from <Home> on an rxvt
 terminal

That is: when --rebindkeypad is in effect -- without this option
they were already getting distinguished.
---
 src/winio.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/winio.c b/src/winio.c
index 8a080815..f8854a1a 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -1027,10 +1027,20 @@ int convert_sequence(const int *seq, size_t seq_len)
 			       * Linux console/xterm/Terminal;
 			       * Esc [ 6 ^ == PageDown on Eterm. */
 			return KEY_NPAGE;
-		    case '7': /* Esc [ 7 ~ == Home on rxvt. */
-			return KEY_HOME;
-		    case '8': /* Esc [ 8 ~ == End on rxvt. */
-			return KEY_END;
+		    case '7': /* Esc [ 7 ~ == Home on Eterm/rxvt,
+			       * Esc [ 7 $ == Shift-Home on Eterm/rxvt. */
+			if (seq_len > 2 && seq[2] == '~')
+			    return KEY_HOME;
+			else if (seq_len > 2 && seq[2] == '$')
+			    return SHIFT_HOME;
+			break;
+		    case '8': /* Esc [ 8 ~ == End on Eterm/rxvt.
+			       * Esc [ 8 $ == Shift-End on Eterm/rxvt. */
+			if (seq_len > 2 && seq[2] == '~')
+			    return KEY_END;
+			else if (seq_len > 2 && seq[2] == '$')
+			    return SHIFT_END;
+			break;
 		    case '9': /* Esc [ 9 == Delete on Mach console. */
 			return KEY_DC;
 		    case '@': /* Esc [ @ == Insert on Mach console. */
-- 
GitLab