From cb7d11b3cf627753204a28e2d7aa1a1b57d9d14b Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Tue, 22 Apr 2014 20:10:43 +0000
Subject: [PATCH] Showing just two shortcuts per function, to pull the
 explanatory lines closer to the key combos.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4807 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 ChangeLog  |  2 ++
 src/help.c | 30 ++++++++++++++++--------------
 2 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1bf5ee5d..570d0331 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,8 @@
 	in the list of shortcuts is enough.
 	* src/global.c (shortcut_init): Put left/right in normal order.
 	* src/global.c (shortcut_init): List function key after meta key.
+	* src/help.c (help_init): Show just two shortcuts per function --
+	only three functions showed three, but who has an F13, F14, F15?
 
 2014-04-21  Benno Schulenberg  <bensberg@justemail.net>
 	* doc/syntax/nanorc.nanorc: There is no F0 key.
diff --git a/src/help.c b/src/help.c
index 80f1374e..5f20e011 100644
--- a/src/help.c
+++ b/src/help.c
@@ -423,11 +423,10 @@ void help_init(void)
 	if (!f->desc || !strcmp(f->desc, ""))
 	    continue;
 
-	/* Let's just try and use the first 3 shortcuts from the new
-	 * struct... */
+	/* Let's simply show the first two shortcuts from the list. */
 	for (s = sclist, scsfound = 0; s != NULL; s = s->next) {
 
-	    if (scsfound == 3)
+	    if (scsfound == 2)
 		continue;
 
 	    if (s->type == RAWINPUT)
@@ -438,18 +437,21 @@ void help_init(void)
 
 	    if (s->scfunc == f->scfunc) {
 		scsfound++;
-
-		if (scsfound == 1)
-		    ptr += sprintf(ptr, "%s", s->keystr);
-		else
-		    ptr += sprintf(ptr, "(%s)", s->keystr);
-		*(ptr++) = '\t';
+		/* Make the first column narrower (6) than the second (10),
+		 * but allow it to spill into the second, for "M-Space". */
+		if (scsfound == 1) {
+		    sprintf(ptr, "%s              ", s->keystr);
+		    ptr += 6;
+		} else {
+		    ptr += sprintf(ptr, "(%s)\t", s->keystr);
+		}
 	    }
 	}
-	/* Pad with tabs if we didn't find 3. */
-	for (; scsfound < 3; scsfound++) {
-	    *(ptr++) = '\t';
-	}
+
+	if (scsfound == 0)
+	    ptr += sprintf(ptr, "\t\t");
+	else if (scsfound == 1)
+	    ptr += 10;
 
 	/* The shortcut's help text. */
 	ptr += sprintf(ptr, "%s\n", _(f->help));
@@ -463,7 +465,7 @@ void help_init(void)
     if (currmenu == MMAIN)
 	for (s = sclist; s != NULL; s = s->next)
 	    if (s->scfunc == do_toggle_void)
-		ptr += sprintf(ptr, "(%s)\t\t\t%s %s\n",
+		ptr += sprintf(ptr, "(%s)\t\t%s %s\n",
 		    s->keystr, _(flagtostr(s->toggle)), _("enable/disable"));
 
 #ifndef DISABLE_NANORC
-- 
GitLab