From db897b574fa195638a42a647096d28c307f140ab Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Thu, 22 Dec 2016 10:42:49 +0100
Subject: [PATCH] input: detect again when both Shift and Ctrl are being held
 on a VT

In nano 2.7.1 and 2.7.2, pressing Shift+Ctrl+Arrow on a Linux console
would behave as if Shift wasn't held.  It got broken three months ago,
by commit 08cd197b, messing up the proper order of the checks.

This fixes https://savannah.gnu.org/bugs/?49906.
---
 src/winio.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/winio.c b/src/winio.c
index 8a5d70a3..697b116d 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -539,6 +539,11 @@ int parse_kbinput(WINDOW *win)
     unsigned char modifiers = 6;
 
     if (console && ioctl(0, TIOCLINUX, &modifiers) >= 0) {
+#ifndef NANO_TINY
+	/* Is Shift being held? */
+	if (modifiers & 0x01)
+	    shift_held = TRUE;
+#endif
 	/* Is Ctrl being held? */
 	if (modifiers & 0x04) {
 	    if (retval == KEY_UP)
@@ -550,12 +555,7 @@ int parse_kbinput(WINDOW *win)
 	    else if (retval == KEY_RIGHT)
 		return sc_seq_or(do_next_word_void, controlright);
 	}
-
 #ifndef NANO_TINY
-	/* Is Shift being held? */
-	if (modifiers & 0x01)
-	    shift_held =TRUE;
-
 	/* Are both Shift and Alt being held? */
 	if ((modifiers & 0x09) == 0x09) {
 	    if (retval == KEY_UP)
-- 
GitLab