From f4a799aaec93a6e02acd53c7e7ff9c0e847c5b42 Mon Sep 17 00:00:00 2001
From: David Lawrence Ramsey <pooka109@gmail.com>
Date: Sat, 8 Jan 2005 06:16:19 +0000
Subject: [PATCH] more minor shortcut-related fixes

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2244 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 ChangeLog   |  8 ++++++++
 src/winio.c | 14 ++++++++------
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f03e24b8..5e7b63c8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -182,13 +182,21 @@ CVS code -
 	- Remove v_first parameter, and go back to the old behavior of
 	  putting back the first character of the escape sequence, as it
 	  worked just as well and was less complicated. (DLR)
+  get_mouseinput()
+	- Return TRUE instead of FALSE only when we have a control key,
+	  a prinary meta key sequence, or both. (DLR)
   get_shortcut()
 	- Add a debug message. (DLR)
 	- Take kbinput as a reference instead of a value, so that it's
 	  translated when the key is translated to its equivalent
 	  control key or meta key shortcut. (DLR)
+	- Return s instead of NULL only when we have a control key, a
+	  prinary meta key sequence, or both. (DLR)
   get_toggle()
 	- Add a debug message. (DLR)
+  bottombars()
+	- Initialize foo, in case a keystroke meets none of the handled
+	  cases. (DLR)
 - configure.ac:
 	- Remove specific references to control key shortcuts. (DLR)
 	- Check for the wide version of ncurses, without which multibyte
diff --git a/src/winio.c b/src/winio.c
index f4e55dbd..fa424ee7 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -1639,12 +1639,13 @@ bool get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts)
 	/* And put back the equivalent key.  Assume that each shortcut
 	 * has, at the very least, an equivalent control key, an
 	 * equivalent primary meta key sequence, or both. */
-	if (s->ctrlval != NANO_NO_KEY)
+	if (s->ctrlval != NANO_NO_KEY) {
 	    unget_kbinput(s->ctrlval, FALSE, FALSE);
-	else if (s->metaval != NANO_NO_KEY)
+	    return TRUE;
+	} else if (s->metaval != NANO_NO_KEY) {
 	    unget_kbinput(s->metaval, TRUE, FALSE);
-
-	return TRUE;
+	    return TRUE;
+	}
     }
     return FALSE;
 }
@@ -1689,12 +1690,13 @@ const shortcut *get_shortcut(const shortcut *s_list, int *kbinput, bool
 	    *meta_key = FALSE;
 	    *func_key = FALSE;
 	    *kbinput = s->ctrlval;
+	    return s;
 	} else if (s->metaval != NANO_NO_KEY) {
 	    *meta_key = TRUE;
 	    *func_key = FALSE;
 	    *kbinput = s->metaval;
+	    return s;
 	}
-	return s;
     }
 
     return NULL;
@@ -3020,7 +3022,7 @@ void bottombars(const shortcut *s)
 	    keystr = _("Up");
 	else {
 #endif
-	    char foo[4];
+	    char foo[4] = "";
 
 	    if (s->ctrlval == NANO_CONTROL_SPACE)
 		strcpy(foo, "^ ");
-- 
GitLab