From 210c94d82f467f11cc33f555593021f4bbb507cc Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sun, 21 Aug 2022 09:35:03 +0200 Subject: [PATCH] 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. --- src/prompt.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/prompt.c b/src/prompt.c index eb09b96d..b105bd12 100644 --- 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; @@ -755,18 +767,6 @@ int ask_user(bool withall, const char *question) choice = UNDECIDED; } } -#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();