mirror of
https://gitlab.gnome.org/GNOME/evince
synced 2024-07-05 00:59:07 +00:00
find-sidebar: don't discard matches without text area
It may happen that a text match has no corresponding text area available, (due to limitations/bugs of Poppler's TextPage->getSelectionWords() function used by poppler-glib poppler_page_get_text_layout_for_area() function) so in that case, instead of discarding the match, we can just show the matched text in the sidebar without surrounding text, because the text area is only needed to retrieve surrounding text. Closes #1943
This commit is contained in:
parent
dc2abdec5b
commit
015e9267e2
|
@ -513,13 +513,23 @@ process_matches_idle (EvFindSidebar *sidebar)
|
|||
|
||||
new_offset = get_match_offset (areas, n_areas, match, offset);
|
||||
if (new_offset == -1) {
|
||||
g_warning ("No offset found for match \"%s\" at page %d after processing %d results\n",
|
||||
priv->job->text, current_page, result);
|
||||
/* It may happen that a vertical text match has no corresponding text area, skip
|
||||
* that but keep iterating to show any other matches in page (issue #1545) */
|
||||
continue;
|
||||
/* It may happen that a text match has no corresponding text area available,
|
||||
* (due to limitations/bugs of Poppler's TextPage->getSelectionWords() used by
|
||||
* poppler-glib poppler_page_get_text_layout_for_area() function) so in that
|
||||
* case we just show matched text because we cannot retrieve surrounding text.
|
||||
* Issue #1943 and related #1545 */
|
||||
markup = g_strdup_printf ("<b>%s</b>", priv->job->text);
|
||||
} else {
|
||||
offset = new_offset;
|
||||
markup = get_surrounding_text_markup (page_text,
|
||||
priv->job->text,
|
||||
priv->job->case_sensitive,
|
||||
text_log_attrs,
|
||||
text_log_attrs_length,
|
||||
offset,
|
||||
match->next_line,
|
||||
match->after_hyphen);
|
||||
}
|
||||
offset = new_offset;
|
||||
|
||||
if (current_page >= priv->job->start_page) {
|
||||
gtk_list_store_append (GTK_LIST_STORE (model), &iter);
|
||||
|
@ -529,15 +539,6 @@ process_matches_idle (EvFindSidebar *sidebar)
|
|||
priv->insert_position++;
|
||||
}
|
||||
|
||||
markup = get_surrounding_text_markup (page_text,
|
||||
priv->job->text,
|
||||
priv->job->case_sensitive,
|
||||
text_log_attrs,
|
||||
text_log_attrs_length,
|
||||
offset,
|
||||
match->next_line,
|
||||
match->after_hyphen);
|
||||
|
||||
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
|
||||
TEXT_COLUMN, markup,
|
||||
PAGE_LABEL_COLUMN, page_label,
|
||||
|
|
Loading…
Reference in New Issue
Block a user