mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-25 06:09:38 +03:00
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:
parent
e291131d0a
commit
9f93b33d29
@ -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
|
||||
|
89
src/search.c
89
src/search.c
@ -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,51 +198,53 @@ 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 an answer was given, remember it. */
|
||||
if (*answer != '\0') {
|
||||
last_search = mallocstrcpy(last_search, answer);
|
||||
#ifndef DISABLE_HISTORIES
|
||||
update_history(&search_history, answer);
|
||||
#endif
|
||||
}
|
||||
if (ISSET(USE_REGEXP) && !regexp_init(last_search))
|
||||
return -1;
|
||||
#endif
|
||||
;
|
||||
#ifndef NANO_TINY
|
||||
} else if (func == case_sens_void) {
|
||||
TOGGLE(CASE_SENSITIVE);
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return 1;
|
||||
} else if (func == backwards_void) {
|
||||
TOGGLE(BACKWARDS_SEARCH);
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return 1;
|
||||
#endif
|
||||
#ifdef HAVE_REGEX_H
|
||||
} else if (func == regexp_void) {
|
||||
TOGGLE(USE_REGEXP);
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return 1;
|
||||
#endif
|
||||
} else if (func == do_replace || func == flip_replace_void) {
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return -2; /* Call the opposite search function. */
|
||||
} 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;
|
||||
/* 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);
|
||||
#ifndef DISABLE_HISTORIES
|
||||
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
|
||||
if (func == case_sens_void) {
|
||||
TOGGLE(CASE_SENSITIVE);
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return 1;
|
||||
} else if (func == backwards_void) {
|
||||
TOGGLE(BACKWARDS_SEARCH);
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return 1;
|
||||
#endif
|
||||
#ifdef HAVE_REGEX_H
|
||||
} else if (func == regexp_void) {
|
||||
TOGGLE(USE_REGEXP);
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return 1;
|
||||
#endif
|
||||
} else if (func == do_replace || func == flip_replace_void) {
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return -2; /* Call the opposite search function. */
|
||||
} else if (func == do_gotolinecolumn_void) {
|
||||
do_gotolinecolumn(openfile->current->lineno,
|
||||
openfile->placewewant + 1, TRUE, TRUE);
|
||||
return 3;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Look for needle, starting at (current, current_x). begin is the line
|
||||
|
Loading…
Reference in New Issue
Block a user