nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 4fd74e0db4fb9db6f7d46bd1681a53c5d50cc3b2
parent 97415dfdc715da735352481c15aa94cb70e67680
Author: David Lawrence Ramsey <pooka109@gmail.com>
Date:   Sun, 23 Apr 2006 01:10:55 +0000

in help_init(), if we have at least two entries' worth of blank space,
use it to display more of "^Space" and "M-Space"


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3414 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

Diffstat:
MChangeLog | 4++++
Msrc/help.c | 23+++++++++++++++++++++--
2 files changed, 25 insertions(+), 2 deletions(-)

diff --git 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 @@ -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);