From 0c319f8b4b40db93479506ab76d53f37f1afa8e9 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Sun, 10 Jul 2016 20:49:52 +0200
Subject: [PATCH] tweaks: put the case labels (the keycodes) in a more sensible
 order

---
 src/winio.c | 79 +++++++++++++++++++++++++++--------------------------
 1 file changed, 40 insertions(+), 39 deletions(-)

diff --git a/src/winio.c b/src/winio.c
index 71f13838..9d02c8c4 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -499,24 +499,6 @@ int parse_kbinput(WINDOW *win)
 
     if (retval != ERR) {
 	switch (retval) {
-	    case NANO_CONTROL_8:
-		retval = ISSET(REBIND_DELETE) ? sc_seq_or(do_delete, 0) :
-			sc_seq_or(do_backspace, 0);
-		break;
-#ifdef KEY_SDOWN
-	    /* ncurses and Slang don't support KEY_SDOWN. */
-	    case KEY_SDOWN:
-#endif
-	    case KEY_DOWN:
-		retval = sc_seq_or(do_down_void, *kbinput);
-		break;
-#ifdef KEY_SUP
-	    /* ncurses and Slang don't support KEY_SUP. */
-	    case KEY_SUP:
-#endif
-	    case KEY_UP:
-		retval = sc_seq_or(do_up_void, *kbinput);
-		break;
 #ifdef KEY_SLEFT
 	    /* Slang doesn't support KEY_SLEFT. */
 	    case KEY_SLEFT:
@@ -531,6 +513,20 @@ int parse_kbinput(WINDOW *win)
 	    case KEY_RIGHT:
 		retval = sc_seq_or(do_right, *kbinput);
 		break;
+#ifdef KEY_SUP
+	    /* ncurses and Slang don't support KEY_SUP. */
+	    case KEY_SUP:
+#endif
+	    case KEY_UP:
+		retval = sc_seq_or(do_up_void, *kbinput);
+		break;
+#ifdef KEY_SDOWN
+	    /* ncurses and Slang don't support KEY_SDOWN. */
+	    case KEY_SDOWN:
+#endif
+	    case KEY_DOWN:
+		retval = sc_seq_or(do_down_void, *kbinput);
+		break;
 #ifdef KEY_SHOME
 	    /* HP-UX 10-11 and Slang don't support KEY_SHOME. */
 	    case KEY_SHOME:
@@ -541,9 +537,35 @@ int parse_kbinput(WINDOW *win)
 	    case KEY_A1:	/* Home (7) on keypad with NumLock off. */
 		retval = sc_seq_or(do_home, *kbinput);
 		break;
+#ifdef KEY_SEND
+	    /* HP-UX 10-11 and Slang don't support KEY_SEND. */
+	    case KEY_SEND:
+#endif
+#ifdef KEY_END
+	    case KEY_END:
+#endif
+	    case KEY_C1:	/* End (1) on keypad with NumLock off. */
+		retval = sc_seq_or(do_end, *kbinput);
+		break;
+	    case KEY_PPAGE:
+	    case KEY_A3:	/* PageUp (9) on keypad with NumLock off. */
+		retval = sc_seq_or(do_page_up, *kbinput);
+		break;
+	    case KEY_NPAGE:
+	    case KEY_C3:	/* PageDown (4) on keypad with NumLock off. */
+		retval = sc_seq_or(do_page_down, *kbinput);
+		break;
+
+	    case KEY_ENTER:
+		retval = sc_seq_or(do_enter, *kbinput);
+		break;
 	    case KEY_BACKSPACE:
 		retval = sc_seq_or(do_backspace, *kbinput);
 		break;
+	    case NANO_CONTROL_8:
+		retval = ISSET(REBIND_DELETE) ? sc_seq_or(do_delete, 0) :
+			sc_seq_or(do_backspace, 0);
+		break;
 #ifdef KEY_SDC
 	    /* Slang doesn't support KEY_SDC. */
 	    case KEY_SDC:
@@ -559,27 +581,6 @@ int parse_kbinput(WINDOW *win)
 		retval = sc_seq_or(do_insertfile_void, *kbinput);
 		break;
 #endif
-	    case KEY_NPAGE:
-	    case KEY_C3:	/* PageDown (4) on keypad with NumLock off. */
-		retval = sc_seq_or(do_page_down, *kbinput);
-		break;
-	    case KEY_PPAGE:
-	    case KEY_A3:	/* PageUp (9) on keypad with NumLock off. */
-		retval = sc_seq_or(do_page_up, *kbinput);
-		break;
-	    case KEY_ENTER:
-		retval = sc_seq_or(do_enter, *kbinput);
-		break;
-#ifdef KEY_SEND
-	    /* HP-UX 10-11 and Slang don't support KEY_SEND. */
-	    case KEY_SEND:
-#endif
-#ifdef KEY_END
-	    case KEY_END:
-#endif
-	    case KEY_C1:	/* End (1) on keypad with NumLock off. */
-		retval = sc_seq_or(do_end, *kbinput);
-		break;
 #ifdef KEY_SBEG
 	    /* Slang doesn't support KEY_SBEG. */
 	    case KEY_SBEG:
-- 
GitLab