Commit bf0bb665 authored by Moritz Lipp's avatar Moritz Lipp

Abort search if page_search_text is not implemented

parent 8fdf18b0
......@@ -286,6 +286,8 @@ cmd_search(girara_session_t* session, const char* input, girara_argument_t* argu
}
bool firsthit = true;
zathura_plugin_error_t error = ZATHURA_PLUGIN_ERROR_OK;
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->document->current_page_number) % zathura->document->number_of_pages];
if (page == NULL) {
......@@ -294,11 +296,16 @@ cmd_search(girara_session_t* session, const char* input, girara_argument_t* argu
g_object_set(page->drawing_area, "draw-links", FALSE, NULL);
girara_list_t* result = zathura_page_search_text(page, input, NULL);
girara_list_t* result = zathura_page_search_text(page, input, &error);
if (result == NULL || girara_list_size(result) == 0) {
girara_list_free(result);
g_object_set(page->drawing_area, "search-results", NULL, NULL);
continue;
if (error == ZATHURA_PLUGIN_ERROR_NOT_IMPLEMENTED) {
break;
} else {
continue;
}
}
g_object_set(page->drawing_area, "search-results", result, 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