commit 1db7d57a248c158a05ff1695aae921ced882522a
parent e32ca98ccf3dcd98f6b9f2c7053615e4c2b5a539
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Wed, 2 Sep 2020 09:22:50 +0200
browser: make M-W/M-Q functional right after startup, if there is history
Do the same what the normal "research" code does: if nothing was
searched for yet during this session, and there is a history of
search items, then search for the last item in that history.
Diffstat:
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/src/browser.c b/src/browser.c
@@ -725,6 +725,12 @@ void do_filesearch(bool forwards)
* either forwards or backwards. */
void do_fileresearch(bool forwards)
{
+#ifdef ENABLE_HISTORIES
+ /* If nothing was searched for yet, take the last item from history. */
+ if (*last_search == '\0' && searchbot->prev != NULL)
+ last_search = mallocstrcpy(last_search, searchbot->prev->data);
+#endif
+
if (*last_search == '\0')
statusbar(_("No current search pattern"));
else