nano

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

commit 1fb820386bf4da675d02fd4758ae90c2fd3fc3ef
parent 99733666852c60f17dc94442e5bb74061359abb5
Author: Benno Schulenberg <bensberg@justemail.net>
Date:   Mon, 26 Dec 2016 20:20:03 +0100

tweaks: chuck a special case, and reduce the scope of two variables

A KEY_WINCH does not need to be separately treated since the basic
action for anything that is not recognized at the yes-no prompt is:
to continue.

Diffstat:
Msrc/prompt.c | 13+++----------
1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/src/prompt.c b/src/prompt.c @@ -736,12 +736,9 @@ int do_yesno_prompt(bool all, const char *msg) * that are accepted for the corresponding answer. Of each variable, * the first character is displayed in the help lines. */ - do { + while (response == -2) { int kbinput; functionptrtype func; -#ifndef DISABLE_MOUSE - int mouse_x, mouse_y; -#endif if (!ISSET(NO_HELP)) { char shortstr[3]; @@ -787,17 +784,13 @@ int do_yesno_prompt(bool all, const char *msg) currmenu = MYESNO; kbinput = get_kbinput(bottomwin); -#ifndef NANO_TINY - if (kbinput == KEY_WINCH) - continue; -#endif - func = func_from_key(&kbinput); if (func == do_cancel) response = -1; #ifndef DISABLE_MOUSE else if (kbinput == KEY_MOUSE) { + int mouse_x, mouse_y; /* We can click on the Yes/No/All shortcuts to select an answer. */ if (get_mouseinput(&mouse_x, &mouse_y, FALSE) == 0 && wmouse_trafo(bottomwin, &mouse_y, &mouse_x, FALSE) && @@ -827,7 +820,7 @@ int do_yesno_prompt(bool all, const char *msg) else if (all && strchr(allstr, kbinput) != NULL) response = 2; } - } while (response == -2); + } free(message);