nano

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

commit 210c94d82f467f11cc33f555593021f4bbb507cc
parent c410ba4d42d1d8248fa12663b856e2d5768f4828
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Sun, 21 Aug 2022 09:35:03 +0200

prompt: allow rebinding also ^N, ^Q, and ^Y at the yes-no prompt

Checking for the literal ^N, ^Q, and ^Y before checking for do_toggle
and full_refresh made it impossible to rebind any of those keystrokes
to these two functions.  (Not that anyone would want this, but...)

Problem existed since version 4.3, commits 341601e1 and 82aea04c.

Diffstat:
Msrc/prompt.c | 24++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/prompt.c b/src/prompt.c @@ -732,6 +732,18 @@ int ask_user(bool withall, const char *question) choice = ALL; else if (func_from_key(kbinput) == do_cancel) choice = CANCEL; + else if (func_from_key(kbinput) == full_refresh) + full_refresh(); +#ifndef NANO_TINY + else if (func_from_key(kbinput) == do_toggle) { + TOGGLE(NO_HELP); + window_init(); + titlebar(NULL); + focusing = FALSE; + edit_refresh(); + focusing = TRUE; + } +#endif /* Interpret ^N and ^Q as "No", to allow exiting in anger. */ else if (kbinput == '\x0E' || kbinput == '\x11') choice = NO; @@ -756,18 +768,6 @@ int ask_user(bool withall, const char *question) } } #endif - else if (func_from_key(kbinput) == full_refresh) - full_refresh(); -#ifndef NANO_TINY - else if (func_from_key(kbinput) == do_toggle) { - TOGGLE(NO_HELP); - window_init(); - titlebar(NULL); - focusing = FALSE; - edit_refresh(); - focusing = TRUE; - } -#endif else beep(); }