From: Benno Schulenberg Date: Tue, 22 Apr 2014 20:10:43 +0000 (+0000) Subject: Showing just two shortcuts per function, to pull X-Git-Tag: v2.3.3~123 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=cb7d11b3cf627753204a28e2d7aa1a1b57d9d14b;p=nano.git 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 --- 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 * 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