From ed6155330959914abd301f476b5aae4b74fe8d62 Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Tue, 7 Feb 2012 18:19:48 +0100 Subject: [PATCH] jump to first result if it is not one the current page --- commands.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/commands.c b/commands.c index 000b765..b732a24 100644 --- a/commands.c +++ b/commands.c @@ -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;