nano

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

commit 89f8d7100106546ac26cb58b79f7d62bb3269a7f
parent a2878bff67d71fd0171a6758a872cdb02dcb7880
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Sat, 19 Sep 2020 12:09:50 +0200

feedback: don't give a hint for <Bsp>, and not after an Alt+key was used

Diffstat:
Msrc/cut.c | 7+------
Msrc/nano.c | 8++++++++
2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/cut.c b/src/cut.c @@ -128,8 +128,6 @@ void do_delete(void) * character, and then delete the character under the cursor. */ void do_backspace(void) { - static bool give_a_hint = TRUE; - #ifndef NANO_TINY if (openfile->mark && ISSET(LET_THEM_ZAP)) zap_text(); @@ -138,10 +136,7 @@ void do_backspace(void) if (openfile->current_x > 0 || openfile->current != openfile->filetop) { do_left(); do_deletion(BACK); - } else if (give_a_hint && !ISSET(NO_HELP)) - statusbar(_("^W = Ctrl+W M-W = Alt+W")); - - give_a_hint = FALSE; + } } /* Return FALSE when a cut command would not actually cut anything: when diff --git a/src/nano.c b/src/nano.c @@ -1526,6 +1526,7 @@ void process_a_keystroke(void) /* The input buffer for actual characters. */ static size_t depth = 0; /* The length of the input buffer. */ + static bool give_a_hint = TRUE; const keystruct *shortcut; /* Read in a keystroke, and show the cursor while waiting. */ @@ -1591,6 +1592,13 @@ void process_a_keystroke(void) return; } + if (input == '\b' && give_a_hint && openfile->current_x == 0 && + openfile->current == openfile->filetop && !ISSET(NO_HELP)) { + statusbar(_("^W = Ctrl+W M-W = Alt+W")); + give_a_hint = FALSE; + } else if (meta_key) + give_a_hint = FALSE; + /* When not cutting or copying text, drop the cutbuffer the next time. */ if (shortcut->func != cut_text) { #ifndef NANO_TINY