Commit ed615533 authored by Sebastian Ramacher's avatar Sebastian Ramacher

jump to first result if it is not one the current page

parent 4450f41e
......@@ -285,9 +285,10 @@ cmd_search(girara_session_t* session, const char* input, girara_argument_t* argu
return false;
}
bool firsthit = true;
for (unsigned int page_id = 0; page_id < zathura->document->number_of_pages; ++page_id) {
zathura_page_t* page = zathura->document->pages[page_id];
if (page == NULL || page->visible == false) {
zathura_page_t* page = zathura->document->pages[(page_id + zathura->document->current_page_number) % zathura->document->number_of_pages];
if (page == NULL) {
continue;
}
......@@ -301,6 +302,12 @@ cmd_search(girara_session_t* session, const char* input, girara_argument_t* argu
}
g_object_set(page->drawing_area, "search-results", result, NULL);
if (firsthit == true) {
if (page_id != 0) {
page_set_delayed(zathura, page->number);
}
firsthit = false;
}
}
return true;
......
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