Reshuffling some stuff to reduce indentation.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5748 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
Benno Schulenberg 2016-03-19 18:51:46 +00:00
parent e291131d0a
commit 9f93b33d29
2 changed files with 47 additions and 43 deletions

View File

@ -7,6 +7,7 @@
* src/browser.c (do_browser): Delete an unneeded variable.
* src/search.c (do_gotolinecolumn): Delete another unneeded variable.
* src/search.c (search_init): Snip an always-FALSE condition.
* src/search.c (search_init): Reshuffle stuff to reduce indentation.
2016-03-17 Benno Schulenberg <bensberg@justemail.net>
* src/search.c (do_research): Use the Search key bindings also during

View File

@ -131,6 +131,7 @@ int search_init(bool replacing, bool use_answer)
char *buf;
static char *backupstring = NULL;
/* The search string we'll be using. */
functionptrtype func;
/* If use_answer is TRUE, set backupstring to answer and get out. */
if (use_answer) {
@ -197,11 +198,10 @@ int search_init(bool replacing, bool use_answer)
if (i == -1 || (i == -2 && *last_search == '\0')) {
statusbar(_("Cancelled"));
return -1;
} else {
functionptrtype func = func_from_key(&i);
}
if (i == -2 || i == 0 ) {
#ifdef HAVE_REGEX_H
/* If Enter was pressed, see what we got. */
if (i == 0 || i == -2) {
/* If an answer was given, remember it. */
if (*answer != '\0') {
last_search = mallocstrcpy(last_search, answer);
@ -209,12 +209,18 @@ int search_init(bool replacing, bool use_answer)
update_history(&search_history, answer);
#endif
}
#ifdef HAVE_REGEX_H
if (ISSET(USE_REGEXP) && !regexp_init(last_search))
return -1;
else
#endif
;
return 0; /* We have a valid string or regex. */
}
func = func_from_key(&i);
#ifndef NANO_TINY
} else if (func == case_sens_void) {
if (func == case_sens_void) {
TOGGLE(CASE_SENSITIVE);
backupstring = mallocstrcpy(backupstring, answer);
return 1;
@ -235,13 +241,10 @@ int search_init(bool replacing, bool use_answer)
} else if (func == do_gotolinecolumn_void) {
do_gotolinecolumn(openfile->current->lineno,
openfile->placewewant + 1, TRUE, TRUE);
/* Put answer up on the statusbar and fall through. */
return 3;
} else
return -1;
}
return 0;
return -1;
}
/* Look for needle, starting at (current, current_x). begin is the line