tweaks: rename some single-letter variables to the same significant word

And simply elide one of those variables.
This commit is contained in:
Benno Schulenberg 2019-05-08 19:17:16 +02:00
parent 247dd8f052
commit c338d86843
3 changed files with 22 additions and 24 deletions

View File

@ -223,11 +223,9 @@ char *do_browser(char *path)
selected = filelist_len - 1;
} else if (func == goto_dir_void) {
/* Ask for the directory to go to. */
int i = do_prompt(TRUE, FALSE, MGOTODIR, NULL, NULL,
if (do_prompt(TRUE, FALSE, MGOTODIR, NULL, NULL,
/* TRANSLATORS: This is a prompt. */
browser_refresh, _("Go To Directory"));
if (i < 0) {
browser_refresh, _("Go To Directory")) < 0) {
statusbar(_("Cancelled"));
continue;
}

View File

@ -1076,7 +1076,7 @@ char *get_next_filename(const char *name, const char *suffix)
* the MULTIBUFFER flag is set. */
void do_insertfile(void)
{
int i;
int response;
const char *msg;
char *given = mallocstrcpy(NULL, "");
/* The last answer the user typed at the statusbar prompt. */
@ -1121,7 +1121,7 @@ void do_insertfile(void)
present_path = mallocstrcpy(present_path, "./");
i = do_prompt(TRUE, TRUE,
response = do_prompt(TRUE, TRUE,
#ifndef NANO_TINY
execute ? MEXTCMD :
#endif
@ -1137,14 +1137,14 @@ void do_insertfile(void)
/* If we're in multibuffer mode and the filename or command is
* blank, open a new buffer instead of canceling. */
if (i == -1 || (i == -2 && !ISSET(MULTIBUFFER))) {
if (response == -1 || (response == -2 && !ISSET(MULTIBUFFER))) {
statusbar(_("Cancelled"));
break;
} else {
ssize_t was_current_lineno = openfile->current->lineno;
size_t was_current_x = openfile->current_x;
#if !defined(NANO_TINY) || defined(ENABLE_BROWSER) || defined(ENABLE_MULTIBUFFER)
functionptrtype func = func_from_key(&i);
functionptrtype func = func_from_key(&response);
#endif
given = mallocstrcpy(given, answer);
@ -1178,7 +1178,7 @@ void do_insertfile(void)
free(answer);
answer = chosen;
i = 0;
response = 0;
}
#endif
#ifndef NANO_TINY
@ -1189,7 +1189,7 @@ void do_insertfile(void)
}
#endif
/* If we don't have a file yet, go back to the prompt. */
if (i != 0 && (!ISSET(MULTIBUFFER) || i != -2))
if (response != 0 && (!ISSET(MULTIBUFFER) || response != -2))
continue;
#ifndef NANO_TINY

View File

@ -93,7 +93,7 @@ void search_init(bool replacing, bool keep_the_answer)
while (TRUE) {
functionptrtype func;
/* Ask the user what to search for (or replace). */
int i = do_prompt(FALSE, FALSE,
int response = do_prompt(FALSE, FALSE,
inhelp ? MFINDINHELP : (replacing ? MREPLACE : MWHEREIS),
answer, &search_history,
/* TRANSLATORS: This is the main search prompt. */
@ -109,13 +109,13 @@ void search_init(bool replacing, bool keep_the_answer)
/* If the search was cancelled, or we have a blank answer and
* nothing was searched for yet during this session, get out. */
if (i == -1 || (i == -2 && *last_search == '\0')) {
if (response == -1 || (response == -2 && *last_search == '\0')) {
statusbar(_("Cancelled"));
break;
}
/* If Enter was pressed, prepare to do a replace or a search. */
if (i == 0 || i == -2) {
if (response == 0 || response == -2) {
/* If an actual answer was typed, remember it. */
if (*answer != '\0') {
last_search = mallocstrcpy(last_search, answer);
@ -137,7 +137,7 @@ void search_init(bool replacing, bool keep_the_answer)
break;
}
func = func_from_key(&i);
func = func_from_key(&response);
/* If we're here, one of the five toggles was pressed, or
* a shortcut was executed. */
@ -686,22 +686,22 @@ void ask_for_replacement(void)
linestruct *edittop_save, *begin;
size_t firstcolumn_save, begin_x;
ssize_t numreplaced;
int i = do_prompt(FALSE, FALSE, MREPLACEWITH, NULL, &replace_history,
int response = do_prompt(FALSE, FALSE, MREPLACEWITH, NULL, &replace_history,
/* TRANSLATORS: This is a prompt. */
edit_refresh, _("Replace with"));
#ifdef ENABLE_HISTORIES
/* If the replace string is not "", add it to the replace history list. */
if (i == 0)
if (response == 0)
update_history(&replace_history, answer);
#endif
/* When cancelled, or when a function was run, get out. */
if (i == -1 || i > 0) {
if (i == -1)
statusbar(_("Cancelled"));
if (response == -1) {
statusbar(_("Cancelled"));
return;
} else if (response > 0)
return;
}
/* Save where we are. */
edittop_save = openfile->edittop;
@ -744,18 +744,18 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
{
if (interactive) {
/* Ask for the line and column. */
int i = do_prompt(FALSE, FALSE, MGOTOLINE,
int response = do_prompt(FALSE, FALSE, MGOTOLINE,
use_answer ? answer : NULL, NULL,
/* TRANSLATORS: This is a prompt. */
edit_refresh, _("Enter line number, column number"));
/* If the user cancelled or gave a blank answer, get out. */
if (i < 0) {
if (response < 0) {
statusbar(_("Cancelled"));
return;
}
if (func_from_key(&i) == flip_goto) {
if (func_from_key(&response) == flip_goto) {
UNSET(BACKWARDS_SEARCH);
/* Retain what the user typed so far and switch to searching. */
search_init(FALSE, TRUE);
@ -763,7 +763,7 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
}
/* If a function was executed, we're done here. */
if (i > 0)
if (response > 0)
return;
/* Try to extract one or two numbers from the user's response. */