From 21856c0061c6c0c0378a298968db573ed417c52e Mon Sep 17 00:00:00 2001 From: Moritz Lipp Date: Sat, 25 Feb 2012 16:56:11 +0100 Subject: [PATCH] Iterate through all search results correctly --- shortcuts.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/shortcuts.c b/shortcuts.c index 9872a14..a926cf2 100644 --- a/shortcuts.c +++ b/shortcuts.c @@ -511,7 +511,7 @@ sc_search(girara_session_t* session, girara_argument_t* argument, target_page = page; target_idx = current + 1; // g_object_set(page->drawing_area, "search-current", current + 1, NULL); - } else if (diff == -1 && current >= 1) { + } else if (diff == -1 && current > 0) { // g_object_set(page->drawing_area, "search-current", current - 1, NULL); target_page = page; target_idx = current - 1; @@ -522,6 +522,7 @@ sc_search(girara_session_t* session, girara_argument_t* argument, for (int npage_id = 1; page_id < num_pages; ++npage_id) { int ntmp = cur_page + diff * (page_id + npage_id); zathura_page_t* npage = zathura->document->pages[(ntmp + 2*num_pages) % num_pages]; + zathura->document->current_page_number = npage->number; g_object_get(npage->drawing_area, "search-length", &num_search_results, NULL); if (num_search_results != 0) { target_page = npage; @@ -530,6 +531,7 @@ sc_search(girara_session_t* session, girara_argument_t* argument, } } } + break; }