From 44c1f77ba4c489b33be860ab1eafd9207fc88e78 Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Fri, 30 Oct 2020 19:35:26 +0100 Subject: [PATCH] [search] Introduced "document.browse.search.reset". Refs #76 Default 1, old behaviour, but if you set it to 0, you can search once, and view results everywhere. --- src/config/options.inc | 6 ++++++ src/session/history.c | 4 +++- src/session/task.c | 4 +++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/config/options.inc b/src/config/options.inc index 5840fcf48..4d064ede5 100644 --- a/src/config/options.inc +++ b/src/config/options.inc @@ -439,6 +439,12 @@ static union option_info config_options_info[] = { "2 for extended regular expression searches")), #endif + INIT_OPT_BOOL("document.browse.search", N_("Reset searching on new pages"), + "reset", 0, 1, + N_("Whether to clear search, when visiting new pages, or going back " + "in history. Default 1. If you set it to 0, you can search once and " + "see results on every page.")), + INIT_OPT_BOOL("document.browse.search", N_("Show search hit top or bottom dialogs"), "show_hit_top_bottom", 0, 1, N_("Whether to show a dialog when the search hits the top or " diff --git a/src/session/history.c b/src/session/history.c index 281ffdc9e..b07a23d86 100644 --- a/src/session/history.c +++ b/src/session/history.c @@ -103,7 +103,9 @@ ses_history_move(struct session *ses) /* Prepare. */ free_files(ses); - mem_free_set(&ses->search_word, NULL); + if (get_opt_bool("document.browse.search.reset", NULL)) { + mem_free_set(&ses->search_word, NULL); + } /* Does it make sense? */ diff --git a/src/session/task.c b/src/session/task.c index 8d01bc9c2..a9964ce6b 100644 --- a/src/session/task.c +++ b/src/session/task.c @@ -312,7 +312,9 @@ ses_forward(struct session *ses, int loaded_in_frame) if (!loaded_in_frame) { free_files(ses); - mem_free_set(&ses->search_word, NULL); + if (get_opt_bool("document.browse.search.reset", NULL)) { + mem_free_set(&ses->search_word, NULL); + } } x: