tweaks: rename some single-letter variables to the same significant word
And simply elide one of those variables.
This commit is contained in:
@@ -223,11 +223,9 @@ char *do_browser(char *path)
|
|||||||
selected = filelist_len - 1;
|
selected = filelist_len - 1;
|
||||||
} else if (func == goto_dir_void) {
|
} else if (func == goto_dir_void) {
|
||||||
/* Ask for the directory to go to. */
|
/* 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. */
|
/* TRANSLATORS: This is a prompt. */
|
||||||
browser_refresh, _("Go To Directory"));
|
browser_refresh, _("Go To Directory")) < 0) {
|
||||||
|
|
||||||
if (i < 0) {
|
|
||||||
statusbar(_("Cancelled"));
|
statusbar(_("Cancelled"));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
12
src/files.c
12
src/files.c
@@ -1076,7 +1076,7 @@ char *get_next_filename(const char *name, const char *suffix)
|
|||||||
* the MULTIBUFFER flag is set. */
|
* the MULTIBUFFER flag is set. */
|
||||||
void do_insertfile(void)
|
void do_insertfile(void)
|
||||||
{
|
{
|
||||||
int i;
|
int response;
|
||||||
const char *msg;
|
const char *msg;
|
||||||
char *given = mallocstrcpy(NULL, "");
|
char *given = mallocstrcpy(NULL, "");
|
||||||
/* The last answer the user typed at the statusbar prompt. */
|
/* The last answer the user typed at the statusbar prompt. */
|
||||||
@@ -1121,7 +1121,7 @@ void do_insertfile(void)
|
|||||||
|
|
||||||
present_path = mallocstrcpy(present_path, "./");
|
present_path = mallocstrcpy(present_path, "./");
|
||||||
|
|
||||||
i = do_prompt(TRUE, TRUE,
|
response = do_prompt(TRUE, TRUE,
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
execute ? MEXTCMD :
|
execute ? MEXTCMD :
|
||||||
#endif
|
#endif
|
||||||
@@ -1137,14 +1137,14 @@ void do_insertfile(void)
|
|||||||
|
|
||||||
/* If we're in multibuffer mode and the filename or command is
|
/* If we're in multibuffer mode and the filename or command is
|
||||||
* blank, open a new buffer instead of canceling. */
|
* blank, open a new buffer instead of canceling. */
|
||||||
if (i == -1 || (i == -2 && !ISSET(MULTIBUFFER))) {
|
if (response == -1 || (response == -2 && !ISSET(MULTIBUFFER))) {
|
||||||
statusbar(_("Cancelled"));
|
statusbar(_("Cancelled"));
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
ssize_t was_current_lineno = openfile->current->lineno;
|
ssize_t was_current_lineno = openfile->current->lineno;
|
||||||
size_t was_current_x = openfile->current_x;
|
size_t was_current_x = openfile->current_x;
|
||||||
#if !defined(NANO_TINY) || defined(ENABLE_BROWSER) || defined(ENABLE_MULTIBUFFER)
|
#if !defined(NANO_TINY) || defined(ENABLE_BROWSER) || defined(ENABLE_MULTIBUFFER)
|
||||||
functionptrtype func = func_from_key(&i);
|
functionptrtype func = func_from_key(&response);
|
||||||
#endif
|
#endif
|
||||||
given = mallocstrcpy(given, answer);
|
given = mallocstrcpy(given, answer);
|
||||||
|
|
||||||
@@ -1178,7 +1178,7 @@ void do_insertfile(void)
|
|||||||
|
|
||||||
free(answer);
|
free(answer);
|
||||||
answer = chosen;
|
answer = chosen;
|
||||||
i = 0;
|
response = 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
@@ -1189,7 +1189,7 @@ void do_insertfile(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
/* If we don't have a file yet, go back to the prompt. */
|
/* 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;
|
continue;
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
|
|||||||
28
src/search.c
28
src/search.c
@@ -93,7 +93,7 @@ void search_init(bool replacing, bool keep_the_answer)
|
|||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
functionptrtype func;
|
functionptrtype func;
|
||||||
/* Ask the user what to search for (or replace). */
|
/* 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),
|
inhelp ? MFINDINHELP : (replacing ? MREPLACE : MWHEREIS),
|
||||||
answer, &search_history,
|
answer, &search_history,
|
||||||
/* TRANSLATORS: This is the main search prompt. */
|
/* 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
|
/* If the search was cancelled, or we have a blank answer and
|
||||||
* nothing was searched for yet during this session, get out. */
|
* 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"));
|
statusbar(_("Cancelled"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If Enter was pressed, prepare to do a replace or a search. */
|
/* 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 an actual answer was typed, remember it. */
|
||||||
if (*answer != '\0') {
|
if (*answer != '\0') {
|
||||||
last_search = mallocstrcpy(last_search, answer);
|
last_search = mallocstrcpy(last_search, answer);
|
||||||
@@ -137,7 +137,7 @@ void search_init(bool replacing, bool keep_the_answer)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
func = func_from_key(&i);
|
func = func_from_key(&response);
|
||||||
|
|
||||||
/* If we're here, one of the five toggles was pressed, or
|
/* If we're here, one of the five toggles was pressed, or
|
||||||
* a shortcut was executed. */
|
* a shortcut was executed. */
|
||||||
@@ -686,22 +686,22 @@ void ask_for_replacement(void)
|
|||||||
linestruct *edittop_save, *begin;
|
linestruct *edittop_save, *begin;
|
||||||
size_t firstcolumn_save, begin_x;
|
size_t firstcolumn_save, begin_x;
|
||||||
ssize_t numreplaced;
|
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. */
|
/* TRANSLATORS: This is a prompt. */
|
||||||
edit_refresh, _("Replace with"));
|
edit_refresh, _("Replace with"));
|
||||||
|
|
||||||
#ifdef ENABLE_HISTORIES
|
#ifdef ENABLE_HISTORIES
|
||||||
/* If the replace string is not "", add it to the replace history list. */
|
/* If the replace string is not "", add it to the replace history list. */
|
||||||
if (i == 0)
|
if (response == 0)
|
||||||
update_history(&replace_history, answer);
|
update_history(&replace_history, answer);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* When cancelled, or when a function was run, get out. */
|
/* When cancelled, or when a function was run, get out. */
|
||||||
if (i == -1 || i > 0) {
|
if (response == -1) {
|
||||||
if (i == -1)
|
statusbar(_("Cancelled"));
|
||||||
statusbar(_("Cancelled"));
|
return;
|
||||||
|
} else if (response > 0)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
/* Save where we are. */
|
/* Save where we are. */
|
||||||
edittop_save = openfile->edittop;
|
edittop_save = openfile->edittop;
|
||||||
@@ -744,18 +744,18 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
|||||||
{
|
{
|
||||||
if (interactive) {
|
if (interactive) {
|
||||||
/* Ask for the line and column. */
|
/* 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,
|
use_answer ? answer : NULL, NULL,
|
||||||
/* TRANSLATORS: This is a prompt. */
|
/* TRANSLATORS: This is a prompt. */
|
||||||
edit_refresh, _("Enter line number, column number"));
|
edit_refresh, _("Enter line number, column number"));
|
||||||
|
|
||||||
/* If the user cancelled or gave a blank answer, get out. */
|
/* If the user cancelled or gave a blank answer, get out. */
|
||||||
if (i < 0) {
|
if (response < 0) {
|
||||||
statusbar(_("Cancelled"));
|
statusbar(_("Cancelled"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (func_from_key(&i) == flip_goto) {
|
if (func_from_key(&response) == flip_goto) {
|
||||||
UNSET(BACKWARDS_SEARCH);
|
UNSET(BACKWARDS_SEARCH);
|
||||||
/* Retain what the user typed so far and switch to searching. */
|
/* Retain what the user typed so far and switch to searching. */
|
||||||
search_init(FALSE, TRUE);
|
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 a function was executed, we're done here. */
|
||||||
if (i > 0)
|
if (response > 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Try to extract one or two numbers from the user's response. */
|
/* Try to extract one or two numbers from the user's response. */
|
||||||
|
|||||||
Reference in New Issue
Block a user