From daae8271e55004b16c01fee5e9b2940e246ce2dc Mon Sep 17 00:00:00 2001 From: Antia Puentes Date: Wed, 17 Jul 2013 15:42:31 +0200 Subject: ev-view-accessibl: Fix get_caret_offset when the caret navigation is enabled https://bugzilla.gnome.org/show_bug.cgi?id=704399 origin commit: https://git.gnome.org/browse/evince/commit/?h=gnome-3-10&id=32a67a6 --- libview/ev-view-accessible.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libview/ev-view-accessible.c b/libview/ev-view-accessible.c index ee35c9a7..5a9ba432 100644 --- a/libview/ev-view-accessible.c +++ b/libview/ev-view-accessible.c @@ -306,6 +306,7 @@ static gint ev_view_accessible_get_caret_offset (AtkText *text) { GtkWidget *widget; + EvView *view; GtkTextBuffer *buffer; GtkTextMark *cursor_mark; GtkTextIter cursor_itr; @@ -316,6 +317,15 @@ ev_view_accessible_get_caret_offset (AtkText *text) /* State is defunct */ return 0; + view = EV_VIEW (widget); + + if (view->caret_enabled) { + if (view->cursor_page == view->current_page) + return view->cursor_offset; + else + return -1; + } + buffer = ev_view_accessible_get_text_buffer (EV_VIEW_ACCESSIBLE (text), EV_VIEW (widget)); if (!buffer) return 0; -- cgit v1.2.1