From b4428a0268bd4eec2d5181daa82634157e1ab3ec Mon Sep 17 00:00:00 2001
From: David Lawrence Ramsey <pooka109@gmail.com>
Date: Wed, 24 May 2006 18:10:41 +0000
Subject: [PATCH] fix breakage

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3556 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 src/nano.c   | 11 +++++++----
 src/prompt.c | 20 ++++++++++++--------
 src/winio.c  |  4 ++--
 3 files changed, 21 insertions(+), 14 deletions(-)

diff --git a/src/nano.c b/src/nano.c
index 628e1322..4f4f8c7d 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -1298,12 +1298,15 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
 	);
 
     /* If we got a non-high-bit control key or a meta key sequence, and
-     * it's not a shortcut or toggle, ignore it, and indicate this on
-     * the statusbar. */
+     * it's not a shortcut or toggle, ignore it.  If it's a meta key
+     * sequence, throw it out completely, so that we don't end up
+     * inserting its second character as though it were typed. */
     if (*s_or_t == FALSE) {
 	if (is_ascii_cntrl_char(input) || *meta_key == TRUE) {
-	    input = ERR;
-	    *meta_key = FALSE;
+	    if (*meta_key == TRUE) {
+		*meta_key = FALSE;
+		input = ERR;
+	    }
 	    statusbar(_("Unknown Command"));
 	}
     }
diff --git a/src/prompt.c b/src/prompt.c
index 0b3ef52c..0fdac602 100644
--- a/src/prompt.c
+++ b/src/prompt.c
@@ -82,11 +82,11 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
 
     /* If we got a shortcut from the current list, or a "universal"
      * statusbar prompt shortcut, set have_shortcut to TRUE. */
-    have_shortcut = (s != NULL || input == NANO_REFRESH_KEY ||
-	input == NANO_HOME_KEY || input == NANO_END_KEY ||
-	input == NANO_BACK_KEY || input == NANO_FORWARD_KEY ||
-	input == NANO_BACKSPACE_KEY || input == NANO_DELETE_KEY ||
-	input == NANO_CUT_KEY ||
+    have_shortcut = (s != NULL || input == NANO_REFRESH_KEY || input ==
+	NANO_HOME_KEY || input == NANO_END_KEY || input ==
+	NANO_BACK_KEY || input == NANO_FORWARD_KEY || input ==
+	NANO_BACKSPACE_KEY || input == NANO_DELETE_KEY || input ==
+	NANO_CUT_KEY ||
 #ifndef NANO_TINY
 	input == NANO_NEXTWORD_KEY ||
 #endif
@@ -100,11 +100,15 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
     *s_or_t = have_shortcut;
 
     /* If we got a non-high-bit control key or a meta key sequence, and
-     * it's not a shortcut or toggle, ignore it. */
+     * it's not a shortcut or toggle, ignore it.  If it's a meta key
+     * sequence, throw it out completely, so that we don't end up
+     * inserting its second character as though it were typed. */
     if (*s_or_t == FALSE) {
 	if (is_ascii_cntrl_char(input) || *meta_key == TRUE) {
-	    input = ERR;
-	    *meta_key = FALSE;
+	    if (*meta_key == TRUE) {
+		*meta_key = FALSE;
+		input = ERR;
+	    }
 	}
     }
 
diff --git a/src/winio.c b/src/winio.c
index df869b55..6f3360ef 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -536,8 +536,8 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key)
 				&ignore_seq);
 
 			/* If the escape sequence is unrecognized and
-			 * not ignored, indicate this on the
-			 * statusbar. */
+			 * not ignored, throw it out completely and
+			 * indicate this on the statusbar. */
 			if (retval == ERR && !ignore_seq)
 			    statusbar(_("Unknown Command"));
 
-- 
GitLab