From 1f204c02040eb813caa4d3618d3cba440225c254 Mon Sep 17 00:00:00 2001
From: David Lawrence Ramsey <pooka109@gmail.com>
Date: Fri, 15 Oct 2004 01:39:46 +0000
Subject: [PATCH] fix spurious warning message in do_gotoline() that was
 introduced when it was overhauled, and also fix some indentation in statusq()

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1990 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 src/search.c |  6 +++--
 src/winio.c  | 74 ++++++++++++++++++++++++++--------------------------
 2 files changed, 41 insertions(+), 39 deletions(-)

diff --git a/src/search.c b/src/search.c
index bc81963b..70b4b563 100644
--- a/src/search.c
+++ b/src/search.c
@@ -924,9 +924,11 @@ void do_gotoline(int line, bool save_pos)
 	    return;
 	}
 
-	/* Bounds check. */
+	/* Do a bounds check.  Display a warning on an out-of-bounds
+	 * line number only if we hit Enter at the statusbar prompt. */
 	if (!parse_num(answer, &line) || line < 0) {
-	    statusbar(_("Come on, be reasonable"));
+	    if (i == 0)
+		statusbar(_("Come on, be reasonable"));
 	    display_main_list();
 	    return;
 	}
diff --git a/src/winio.c b/src/winio.c
index 632b3539..226a7897 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -2161,44 +2161,44 @@ int statusq(bool allow_tabs, const shortcut *s, const char *def,
     resetstatuspos = FALSE;
 
     switch (ret) {
-    case NANO_FIRSTLINE_KEY:
-    case NANO_FIRSTLINE_FKEY:
-	do_first_line();
-	resetstatuspos = TRUE;
-	break;
-    case NANO_LASTLINE_KEY:
-    case NANO_LASTLINE_FKEY:
-	do_last_line();
-	resetstatuspos = TRUE;
-	break;
+	case NANO_FIRSTLINE_KEY:
+	case NANO_FIRSTLINE_FKEY:
+	    do_first_line();
+	    resetstatuspos = TRUE;
+	    break;
+	case NANO_LASTLINE_KEY:
+	case NANO_LASTLINE_FKEY:
+	    do_last_line();
+	    resetstatuspos = TRUE;
+	    break;
 #ifndef DISABLE_JUSTIFY
-    case NANO_PARABEGIN_KEY:
-    case NANO_PARABEGIN_ALTKEY1:
-    case NANO_PARABEGIN_ALTKEY2:
-	do_para_begin();
-	resetstatuspos = TRUE;
-	break;
-    case NANO_PARAEND_KEY:
-    case NANO_PARAEND_ALTKEY1:
-    case NANO_PARAEND_ALTKEY2:
-	do_para_end();
-	resetstatuspos = TRUE;
-	break;
-    case NANO_FULLJUSTIFY_KEY:
-    case NANO_FULLJUSTIFY_ALTKEY:
-	if (!ISSET(VIEW_MODE))
-	    do_full_justify();
-	resetstatuspos = TRUE;
-	break;
-#endif
-    case NANO_CANCEL_KEY:
-	ret = -1;
-	resetstatuspos = TRUE;
-	break;
-    case NANO_ENTER_KEY:
-	ret = (answer[0] == '\0') ? -2 : 0;
-	resetstatuspos = TRUE;
-	break;
+	case NANO_PARABEGIN_KEY:
+	case NANO_PARABEGIN_ALTKEY1:
+	case NANO_PARABEGIN_ALTKEY2:
+	    do_para_begin();
+	    resetstatuspos = TRUE;
+	    break;
+	case NANO_PARAEND_KEY:
+	case NANO_PARAEND_ALTKEY1:
+	case NANO_PARAEND_ALTKEY2:
+	    do_para_end();
+	    resetstatuspos = TRUE;
+	    break;
+	case NANO_FULLJUSTIFY_KEY:
+	case NANO_FULLJUSTIFY_ALTKEY:
+	    if (!ISSET(VIEW_MODE))
+		do_full_justify();
+	    resetstatuspos = TRUE;
+	    break;
+#endif
+	case NANO_CANCEL_KEY:
+	    ret = -1;
+	    resetstatuspos = TRUE;
+	    break;
+	case NANO_ENTER_KEY:
+	    ret = (answer[0] == '\0') ? -2 : 0;
+	    resetstatuspos = TRUE;
+	    break;
     }
     blank_statusbar();
 
-- 
GitLab