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
master
David Lawrence Ramsey 2006-06-19 16:04:42 +00:00
parent bd2c8f3d2d
commit 23ed015725
2 changed files with 12 additions and 20 deletions

View File

@ -264,8 +264,9 @@ CVS code -
easier for translators to see. (Benno Schulenberg) easier for translators to see. (Benno Schulenberg)
- Make sure we have enough memory in all cases when displaying - Make sure we have enough memory in all cases when displaying
the shortcut and toggle lists. (DLR) the shortcut and toggle lists. (DLR)
- Wrap the shortcut list help text, for consistency with the - Wrap the shortcut list help text, and display it even when we
toggle help text. (DLR, suggested by Benno Schulenberg) have fewer than 24 columns, for consistency with the toggle
help text. (DLR, suggested by Benno Schulenberg)
parse_help_input() parse_help_input()
- Add Space and - as aliases for PageDown and PageUp, for - Add Space and - as aliases for PageDown and PageUp, for
consistency with the file browser. (DLR, suggested by Benno consistency with the file browser. (DLR, suggested by Benno

View File

@ -385,24 +385,19 @@ void help_init(void)
/* Count the shortcut help text. Each entry has up to three keys, /* Count the shortcut help text. Each entry has up to three keys,
* which fill 24 columns, plus translated text, plus one or two * 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 * \n's. */
* or fewer columns. */ for (s = currshortcut; s != NULL; s = s->next)
for (s = currshortcut; s != NULL; s = s->next) { allocsize += (24 * mb_cur_max()) + strlen(s->help) + 2;
allocsize += (24 * mb_cur_max()) + 1;
if (COLS >= 24)
allocsize += strlen(s->help) + 1;
}
#ifndef NANO_TINY #ifndef NANO_TINY
/* If we're on the main list, we also count the toggle help text. /* 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 * Each entry has "M-%c\t\t\t", which fills 24 columns, plus a
* space, plus translated text, plus one or two '\n's. */ * space, plus translated text, plus one or two '\n's. */
if (currshortcut == main_list) { 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) for (t = toggles; t != NULL; t = t->next)
allocsize += (24 * mb_cur_max()) + strlen(t->desc) + allocsize += strlen(t->desc) + endis_len + 9;
endis_len + 2;
} }
#endif #endif
@ -530,10 +525,8 @@ void help_init(void)
} }
} }
if (COLS > 24) /* The shortcut's help text. */
ptr += sprintf(ptr, "%s", s->help); ptr += sprintf(ptr, "%s\n", s->help);
ptr += sprintf(ptr, "\n");
if (s->blank_after) if (s->blank_after)
ptr += sprintf(ptr, "\n"); ptr += sprintf(ptr, "\n");
@ -543,10 +536,8 @@ void help_init(void)
/* And the toggles... */ /* And the toggles... */
if (currshortcut == main_list) { if (currshortcut == main_list) {
for (t = toggles; t != NULL; t = t->next) { for (t = toggles; t != NULL; t = t->next) {
if (t->val != TOGGLE_NO_KEY) ptr += sprintf(ptr, "M-%c\t\t\t%s %s\n",
ptr += sprintf(ptr, "M-%c\t\t\t%s %s", toupper(t->val), t->desc, _("enable/disable"));
toupper(t->val), t->desc, _("enable/disable"));
ptr += sprintf(ptr, "\n");
if (t->blank_after) if (t->blank_after)
ptr += sprintf(ptr, "\n"); ptr += sprintf(ptr, "\n");