Renaming a variable for clarity.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5620 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
Benno Schulenberg 2016-02-07 13:41:46 +00:00
parent e5fee7e649
commit e853c1ee7c
2 changed files with 11 additions and 10 deletions

View File

@ -7,6 +7,7 @@
* doc/syntax/c.nanorc: Use a character class instead of a literal tab * doc/syntax/c.nanorc: Use a character class instead of a literal tab
and space. The change was inspired by David Niklas. and space. The change was inspired by David Niklas.
* src/prompt.c (do_yesno_prompt): Normalize the indentation. * src/prompt.c (do_yesno_prompt): Normalize the indentation.
* src/prompt.c (do_yesno_prompt): Rename a variable.
2016-02-06 Benno Schulenberg <bensberg@justemail.net> 2016-02-06 Benno Schulenberg <bensberg@justemail.net>
* src/files.c (write_file): Remove the --nofollow option that hasn't * src/files.c (write_file): Remove the --nofollow option that hasn't

View File

@ -830,7 +830,7 @@ int do_prompt(bool allow_tabs,
* TRUE when passed in), and -1 for Cancel. */ * TRUE when passed in), and -1 for Cancel. */
int do_yesno_prompt(bool all, const char *msg) int do_yesno_prompt(bool all, const char *msg)
{ {
int ok = -2, width = 16; int response = -2, width = 16;
const char *yesstr; /* String of Yes characters accepted. */ const char *yesstr; /* String of Yes characters accepted. */
const char *nostr; /* Same for No. */ const char *nostr; /* Same for No. */
const char *allstr; /* And All, surprise! */ const char *allstr; /* And All, surprise! */
@ -910,7 +910,7 @@ int do_yesno_prompt(bool all, const char *msg)
func = func_from_key(&kbinput); func = func_from_key(&kbinput);
if (func == do_cancel) if (func == do_cancel)
ok = -1; response = -1;
#ifndef DISABLE_MOUSE #ifndef DISABLE_MOUSE
else if (kbinput == KEY_MOUSE) { else if (kbinput == KEY_MOUSE) {
/* We can click on the Yes/No/All shortcuts to select an answer. */ /* We can click on the Yes/No/All shortcuts to select an answer. */
@ -926,10 +926,10 @@ int do_yesno_prompt(bool all, const char *msg)
/* x == 0 means they clicked Yes or No. /* x == 0 means they clicked Yes or No.
* y == 0 means Yes or All. */ * y == 0 means Yes or All. */
ok = -2 * x * y + x - y + 1; response = -2 * x * y + x - y + 1;
if (ok == 2 && !all) if (response == 2 && !all)
ok = -2; response = -2;
} }
} }
#endif /* !DISABLE_MOUSE */ #endif /* !DISABLE_MOUSE */
@ -939,14 +939,14 @@ int do_yesno_prompt(bool all, const char *msg)
} else { } else {
/* Look for the kbinput in the Yes, No (and All) strings. */ /* Look for the kbinput in the Yes, No (and All) strings. */
if (strchr(yesstr, kbinput) != NULL) if (strchr(yesstr, kbinput) != NULL)
ok = 1; response = 1;
else if (strchr(nostr, kbinput) != NULL) else if (strchr(nostr, kbinput) != NULL)
ok = 0; response = 0;
else if (all && strchr(allstr, kbinput) != NULL) else if (all && strchr(allstr, kbinput) != NULL)
ok = 2; response = 2;
} }
} while (ok == -2); } while (response == -2);
currmenu = oldmenu; currmenu = oldmenu;
return ok; return response;
} }