From 272a9538891e1b60d101dd0c4827040e699bba5e Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Tue, 30 Aug 2016 10:11:29 +0200
Subject: [PATCH] tweaks: fix compilation when configured with --with-slang

---
 src/nano.h  |  2 ++
 src/winio.c | 14 ++++++++++----
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/nano.h b/src/nano.h
index 0f402952..013296fe 100644
--- a/src/nano.h
+++ b/src/nano.h
@@ -576,6 +576,8 @@ enum
 #define SHIFT_ALT_DOWN 0x40c
 #define SHIFT_PAGEUP 0x40d
 #define SHIFT_PAGEDOWN 0x40e
+#define SHIFT_HOME 0x40f
+#define SHIFT_END 0x410
 
 #ifndef NANO_TINY
 /* An imaginary key for when we get a SIGWINCH (window resize). */
diff --git a/src/winio.c b/src/winio.c
index c0d945e4..07845399 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -584,6 +584,7 @@ int parse_kbinput(WINDOW *win)
 	    shift_held = TRUE;
 	    return sc_seq_or(do_right, keycode);
 #endif
+#ifdef KEY_SR
 #ifdef KEY_SUP
 	/* ncurses and Slang don't support KEY_SUP. */
 	case KEY_SUP:
@@ -591,6 +592,8 @@ int parse_kbinput(WINDOW *win)
 	case KEY_SR:	/* Scroll backward, on Xfce4-terminal. */
 	    shift_held = TRUE;
 	    return sc_seq_or(do_up_void, keycode);
+#endif
+#ifdef KEY_SF
 #ifdef KEY_SDOWN
 	/* ncurses and Slang don't support KEY_SDOWN. */
 	case KEY_SDOWN:
@@ -598,18 +601,21 @@ int parse_kbinput(WINDOW *win)
 	case KEY_SF:	/* Scroll forward, on Xfce4-terminal. */
 	    shift_held = TRUE;
 	    return sc_seq_or(do_down_void, keycode);
+#endif
 #ifdef KEY_SHOME
 	/* HP-UX 10-11 and Slang don't support KEY_SHOME. */
 	case KEY_SHOME:
-	    shift_held = TRUE;
 #endif
+	case SHIFT_HOME:
+	    shift_held = TRUE;
 	case KEY_A1:	/* Home (7) on keypad with NumLock off. */
 	    return sc_seq_or(do_home, keycode);
 #ifdef KEY_SEND
 	/* HP-UX 10-11 and Slang don't support KEY_SEND. */
 	case KEY_SEND:
-	    shift_held = TRUE;
 #endif
+	case SHIFT_END:
+	    shift_held = TRUE;
 	case KEY_C1:	/* End (1) on keypad with NumLock off. */
 	    return sc_seq_or(do_end, keycode);
 #ifndef NANO_TINY
@@ -927,9 +933,9 @@ int convert_sequence(const int *seq, size_t seq_len)
 		    case 'B': /* Esc [ 1 ; 4 B == Shift-Alt-Down on xterm. */
 			return SHIFT_PAGEDOWN;
 		    case 'C': /* Esc [ 1 ; 4 C == Shift-Alt-Right on xterm. */
-			return KEY_SEND;
+			return SHIFT_END;
 		    case 'D': /* Esc [ 1 ; 4 D == Shift-Alt-Left on xterm. */
-			return KEY_SHOME;
+			return SHIFT_HOME;
 		}
 		break;
 #endif
-- 
GitLab