tweaks: condense a bit of code

Make it equal to what the normal search code does.
master
Benno Schulenberg 2020-09-02 09:15:23 +02:00
parent 5a635db262
commit e32ca98ccf
1 changed files with 4 additions and 8 deletions

View File

@ -710,19 +710,15 @@ void do_filesearch(bool forwards)
if (filesearch_init(forwards) != 0)
return;
/* If answer is now "", copy last_search into answer. */
if (*answer == '\0')
answer = mallocstrcpy(answer, last_search);
else
/* If the user typed an answer, remember it. */
if (*answer != '\0') {
last_search = mallocstrcpy(last_search, answer);
#ifdef ENABLE_HISTORIES
/* If answer is not empty, add the string to the search history list. */
if (*answer != '\0')
update_history(&search_history, answer);
#endif
}
findfile(answer, forwards);
findfile(last_search, forwards);
}
/* Search again without prompting for the last given search string,