commit e32ca98ccf3dcd98f6b9f2c7053615e4c2b5a539
parent 5a635db262d1eb58c3f011b5e0029f561c6c84cc
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Wed, 2 Sep 2020 09:15:23 +0200
tweaks: condense a bit of code
Make it equal to what the normal search code does.
Diffstat:
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/src/browser.c b/src/browser.c
@@ -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,