diff --git a/ChangeLog b/ChangeLog index 94ac1f5251f6ce1801767c784ca4017aa7301961..b5dff26afedd1fe73deffc76c4ec56d580d4a6be 100644 --- a/ChangeLog +++ b/ChangeLog @@ -102,6 +102,10 @@ CVS code - - Call get_shortcut() after getting input, so that we only have to check for a main shortcut key instead of both it and all of its equivalents. (DLR) + help_init() + - If we have at least two entries' worth of blank space, use it + to display more of "^Space" and "M-Space". (DLR, suggested by + Benno Schulenberg) - nano.c: renumber() - Remove invalid assert. (DLR, found by Filipe Moreira) diff --git a/src/help.c b/src/help.c index 9d12c7b55040a55bddff01bfa22441f8c2b4a429..0ec01e397f0b24ae975794da3cef9fa81c038b1b 100644 --- a/src/help.c +++ b/src/help.c @@ -414,9 +414,22 @@ void help_init(void) /* Yucky sentinel values that we can't handle a better * way. */ if (s->ctrlval == NANO_CONTROL_SPACE) { - char *space_ptr = display_string(_("Space"), 0, 6, + char *space_ptr = display_string(_("Space"), 0, 13, FALSE); + if (s->funcval == NANO_NO_KEY && (s->metaval == + NANO_NO_KEY || s->miscval == NANO_NO_KEY)) { + /* If we're here, we have at least two entries worth + * of blank space. If this entry takes up more than + * one entry's worth of space, use two to display + * it. */ + if (strlen(space_ptr) + 1 > 7) + entries++; + } else + /* Otherwise, truncate it so that it takes up only + * one entry's worth of space. */ + space_ptr[7] = '\0'; + ptr += sprintf(ptr, "^%s", space_ptr); free(space_ptr); @@ -452,9 +465,15 @@ void help_init(void) /* Yucky sentinel values that we can't handle a better * way. */ if (s->metaval == NANO_ALT_SPACE && entries == 1) { - char *space_ptr = display_string(_("Space"), 0, 5, + char *space_ptr = display_string(_("Space"), 0, 13, FALSE); + /* If we're here, we have at least two entries worth of + * blank space. If this entry takes up more than one + * entry's worth of space, use two to display it. */ + if (strlen(space_ptr) + 2 > 7) + entries++; + ptr += sprintf(ptr, "M-%s", space_ptr); free(space_ptr);