mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-11-10 21:13:48 +01:00
Abort search if page_search_text is not implemented
This commit is contained in:
parent
8fdf18b088
commit
bf0bb66503
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;
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user