commit 23ed015725ac02f0ba27ecaf1454b5200791386a
parent bd2c8f3d2d9c09acb342a29c8454611c52658b34
Author: David Lawrence Ramsey <pooka109@gmail.com>
Date: Mon, 19 Jun 2006 16:04:42 +0000
in help_init(), display the shortcut list help text even when we have
fewer than 24 columns, for consistency with the toggle help text, and
add various minor consistency fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3669 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Diffstat:
2 files changed, 12 insertions(+), 20 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -264,8 +264,9 @@ CVS code -
easier for translators to see. (Benno Schulenberg)
- Make sure we have enough memory in all cases when displaying
the shortcut and toggle lists. (DLR)
- - Wrap the shortcut list help text, for consistency with the
- toggle help text. (DLR, suggested by Benno Schulenberg)
+ - Wrap the shortcut list help text, and display it even when we
+ have fewer than 24 columns, for consistency with the toggle
+ help text. (DLR, suggested by Benno Schulenberg)
parse_help_input()
- Add Space and - as aliases for PageDown and PageUp, for
consistency with the file browser. (DLR, suggested by Benno
diff --git a/src/help.c b/src/help.c
@@ -385,24 +385,19 @@ void help_init(void)
/* Count the shortcut help text. Each entry has up to three keys,
* which fill 24 columns, plus translated text, plus one or two
- * \n's. Note that the translated text is left out if there are 24
- * or fewer columns. */
- for (s = currshortcut; s != NULL; s = s->next) {
- allocsize += (24 * mb_cur_max()) + 1;
- if (COLS >= 24)
- allocsize += strlen(s->help) + 1;
- }
+ * \n's. */
+ for (s = currshortcut; s != NULL; s = s->next)
+ allocsize += (24 * mb_cur_max()) + strlen(s->help) + 2;
#ifndef NANO_TINY
/* If we're on the main list, we also count the toggle help text.
* Each entry has "M-%c\t\t\t", which fills 24 columns, plus a
* space, plus translated text, plus one or two '\n's. */
if (currshortcut == main_list) {
- size_t endis_len = strlen(_("enable/disable")) + 1;
+ size_t endis_len = strlen(_("enable/disable"));
for (t = toggles; t != NULL; t = t->next)
- allocsize += (24 * mb_cur_max()) + strlen(t->desc) +
- endis_len + 2;
+ allocsize += strlen(t->desc) + endis_len + 9;
}
#endif
@@ -530,10 +525,8 @@ void help_init(void)
}
}
- if (COLS > 24)
- ptr += sprintf(ptr, "%s", s->help);
-
- ptr += sprintf(ptr, "\n");
+ /* The shortcut's help text. */
+ ptr += sprintf(ptr, "%s\n", s->help);
if (s->blank_after)
ptr += sprintf(ptr, "\n");
@@ -543,10 +536,8 @@ void help_init(void)
/* And the toggles... */
if (currshortcut == main_list) {
for (t = toggles; t != NULL; t = t->next) {
- if (t->val != TOGGLE_NO_KEY)
- ptr += sprintf(ptr, "M-%c\t\t\t%s %s",
- toupper(t->val), t->desc, _("enable/disable"));
- ptr += sprintf(ptr, "\n");
+ ptr += sprintf(ptr, "M-%c\t\t\t%s %s\n",
+ toupper(t->val), t->desc, _("enable/disable"));
if (t->blank_after)
ptr += sprintf(ptr, "\n");