commit aba4f4e0e2a7956b7313ec971bb00248e10bb550
parent 210c94d82f467f11cc33f555593021f4bbb507cc
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Sun, 21 Aug 2022 09:55:22 +0200
tweaks: avoid sometimes calling a function three times in a row
Diffstat:
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/prompt.c b/src/prompt.c
@@ -639,6 +639,7 @@ int ask_user(bool withall, const char *question)
const char *yesstr = _("Yy");
const char *nostr = _("Nn");
const char *allstr = _("Aa");
+ functionptrtype function;
while (choice == UNDECIDED) {
#ifdef ENABLE_NLS
@@ -730,12 +731,18 @@ int ask_user(bool withall, const char *question)
choice = NO;
else if (withall && strchr("Aa", kbinput) != NULL)
choice = ALL;
- else if (func_from_key(kbinput) == do_cancel)
+
+ if (choice != UNDECIDED)
+ break;
+
+ function = func_from_key(kbinput);
+
+ if (function == do_cancel)
choice = CANCEL;
- else if (func_from_key(kbinput) == full_refresh)
+ else if (function == full_refresh)
full_refresh();
#ifndef NANO_TINY
- else if (func_from_key(kbinput) == do_toggle) {
+ else if (function == do_toggle) {
TOGGLE(NO_HELP);
window_init();
titlebar(NULL);