Commit d24ad831 authored by Sebastian Ramacher's avatar Sebastian Ramacher

Add setting abort-clear-search and clear search results on abort if set.

parent 1e1b55de
......@@ -140,6 +140,8 @@ config_load_default(zathura_t* zathura)
girara_setting_add(gsession, "open-first-page", &bool_value, BOOLEAN, false, _("Always open on first page"), NULL, NULL);
bool_value = false;
girara_setting_add(gsession, "nohlsearch", &bool_value, BOOLEAN, false, _("Highlight search results"), cb_nohlsearch_changed, NULL);
bool_value = true;
girara_setting_add(gsession, "abort-clear-search", &bool_value, BOOLEAN, false, _("Clear search results on abort"), NULL, NULL);
/* define default shortcuts */
girara_shortcut_add(gsession, GDK_CONTROL_MASK, GDK_KEY_c, NULL, sc_abort, 0, 0, NULL);
......
......@@ -26,6 +26,9 @@ sc_abort(girara_session_t* session, girara_argument_t* UNUSED(argument),
g_return_val_if_fail(session->global.data != NULL, false);
zathura_t* zathura = session->global.data;
bool clear_search = true;
girara_setting_get(session, "abort-clear-search", &clear_search);
if (zathura->document != NULL) {
unsigned int number_of_pages = zathura_document_get_number_of_pages(zathura->document);
for (unsigned int page_id = 0; page_id < number_of_pages; ++page_id) {
......@@ -35,6 +38,9 @@ sc_abort(girara_session_t* session, girara_argument_t* UNUSED(argument),
}
g_object_set(zathura_page_get_widget(zathura, page), "draw-links", FALSE, NULL);
if (clear_search) {
g_object_set(zathura_page_get_widget(zathura, page), "search-results", NULL, NULL);
}
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment