mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-01-04 02:36:02 +01:00
jump to first result if it is not one the current page
This commit is contained in:
parent
4450f41e1e
commit
ed61553309
1 changed files with 9 additions and 2 deletions
11
commands.c
11
commands.c
|
@ -285,9 +285,10 @@ cmd_search(girara_session_t* session, const char* input, girara_argument_t* argu
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool firsthit = true;
|
||||||
for (unsigned int page_id = 0; page_id < zathura->document->number_of_pages; ++page_id) {
|
for (unsigned int page_id = 0; page_id < zathura->document->number_of_pages; ++page_id) {
|
||||||
zathura_page_t* page = zathura->document->pages[page_id];
|
zathura_page_t* page = zathura->document->pages[(page_id + zathura->document->current_page_number) % zathura->document->number_of_pages];
|
||||||
if (page == NULL || page->visible == false) {
|
if (page == NULL) {
|
||||||
continue;
|
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);
|
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;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue