From 4b376a4982fd5e78781dd79e214af4a46078d21a Mon Sep 17 00:00:00 2001
From: Chris Allegretta <chrisa@asty.org>
Date: Wed, 16 Apr 2003 02:08:23 +0000
Subject: [PATCH] latest fixes

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1490 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 ChangeLog |  5 +++++
 winio.c   | 19 ++++++++++++++-----
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 15ba5559..23891d99 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -55,6 +55,11 @@ CVS code -
 	  setting current and current_x back to their original values,
 	  in case current_x's original value is greater than the width
 	  of the screen. (DLR)
+- winio.c:
+  nanogetstr()
+	- Remove a few unnecessary breaks occurring immediately after
+	  gotos, and properly interpret the up and down arrow keys when
+	  ALT_KEYPAD is set. (DLR)
 - configure.ac:
 	- Enable autodetection of broken regexec(). (DLR) Re-added 
 	  regex.h check to ensure compile under Debian w/autoconf 1.6.
diff --git a/winio.c b/winio.c
index 1731eabf..ff5c6ef7 100644
--- a/winio.c
+++ b/winio.c
@@ -358,6 +358,7 @@ int nanogetstr(int allowtabs, const char *buf, const char *def,
 	case KEY_UP:
 	case NANO_UP_KEY:
 #ifndef NANO_SMALL
+  do_upkey:
 	    if (history_list != NULL) {
 
 		/* If there's no previous temp holder, or if we already
@@ -383,6 +384,7 @@ int nanogetstr(int allowtabs, const char *buf, const char *def,
 	case KEY_DOWN:
 	case NANO_DOWN_KEY:
 #ifndef NANO_SMALL
+  do_downkey:
 	    if (history_list != NULL) {
 		/* get newer search from the history list */
 		if ((history = get_history_newer(history_list)) != NULL) {
@@ -421,6 +423,18 @@ int nanogetstr(int allowtabs, const char *buf, const char *def,
 		break;
 	    case '[':
 		switch (kbinput = wgetch(edit)) {
+		case 'A':
+#ifndef NANO_SMALL
+		    goto do_upkey;
+#else
+		    break;
+#endif
+		case 'B':
+#ifndef NANO_SMALL
+		    goto do_downkey;
+#else
+		    break;
+#endif
 		case 'C':
 		    if (x < xend)
 			x++;
@@ -836,7 +850,6 @@ void edit_add(const filestruct *fileptr, int yval, int start
 		if (paintlen == COLS)
 		    goto skip_step_two;
 
-
   step_two:	/* Second step, we look for starts on this line. */
 		start_col = 0;
 		while (start_col < start + COLS) {
@@ -1532,19 +1545,15 @@ int do_help(void)
 		    case '5':	/* Alt-[-5 = Page Up */
 			wgetch(edit);
 			goto do_pageupkey;
-			break;
 		    case 'V':	/* Alt-[-V = Page Up in Hurd Console */
 		    case 'I':	/* Alt-[-I = Page Up - FreeBSD Console */
 			goto do_pageupkey;
-			break;
 		    case '6':	/* Alt-[-6 = Page Down */
 			wgetch(edit);
 			goto do_pagedownkey;
-			break;
 		    case 'U':	/* Alt-[-U = Page Down in Hurd Console */
 		    case 'G':	/* Alt-[-G = Page Down - FreeBSD Console */
 			goto do_pagedownkey;
-			break;
 		}
 		break;
 	    }
-- 
GitLab