mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-01-16 20:47:51 +01:00
Abort search if page_search_text is not implemented
This commit is contained in:
parent
8fdf18b088
commit
bf0bb66503
1 changed files with 9 additions and 2 deletions
11
commands.c
11
commands.c
|
@ -286,6 +286,8 @@ cmd_search(girara_session_t* session, const char* input, girara_argument_t* argu
|
||||||
}
|
}
|
||||||
|
|
||||||
bool firsthit = true;
|
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) {
|
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];
|
zathura_page_t* page = zathura->document->pages[(page_id + zathura->document->current_page_number) % zathura->document->number_of_pages];
|
||||||
if (page == NULL) {
|
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);
|
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) {
|
if (result == NULL || girara_list_size(result) == 0) {
|
||||||
girara_list_free(result);
|
girara_list_free(result);
|
||||||
g_object_set(page->drawing_area, "search-results", NULL, NULL);
|
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);
|
g_object_set(page->drawing_area, "search-results", result, NULL);
|
||||||
|
|
Loading…
Reference in a new issue