summaryrefslogtreecommitdiff
path: root/libview/ev-view.c
diff options
context:
space:
mode:
authorAntia Puentes <[email protected]>2013-06-26 17:40:10 +0200
committerraveit65 <[email protected]>2017-09-06 18:25:34 +0200
commit0787e98dde0476c004758dad7a993bc8ff926cbe (patch)
tree3bbfabaad2d6074f304489e742cb9a1b8dd34e6d /libview/ev-view.c
parent502b35b6de941c3aa6643a5bf9ef37f1b985ec01 (diff)
downloadatril-0787e98dde0476c004758dad7a993bc8ff926cbe.tar.bz2
atril-0787e98dde0476c004758dad7a993bc8ff926cbe.tar.xz
libview: Keep the offset inside a line when moving the caret between lines
https://bugzilla.gnome.org/show_bug.cgi?id=702075 origin commit: https://git.gnome.org/browse/evince/commit/?h=gnome-3-10&id=255b977
Diffstat (limited to 'libview/ev-view.c')
-rw-r--r--libview/ev-view.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/libview/ev-view.c b/libview/ev-view.c
index 118d51d3..6a112253 100644
--- a/libview/ev-view.c
+++ b/libview/ev-view.c
@@ -4388,6 +4388,11 @@ ev_view_button_press_event (GtkWidget *widget,
start_selection_for_event (view, event);
if (position_caret_cursor_at_location (view, event->x, event->y)) {
+ GdkRectangle area;
+
+ if (get_caret_cursor_area (view, view->cursor_page, view->cursor_offset, &area))
+ view->cursor_line_offset = area.x;
+
view->cursor_blink_time = 0;
ev_view_pend_cursor_blink (view);
@@ -4858,7 +4863,12 @@ ev_view_button_release_event (GtkWidget *widget,
clear_link_selected (view);
ev_view_update_primary_selection (view);
- position_caret_cursor_at_location (view, event->x, event->y);
+ if (position_caret_cursor_at_location (view, event->x, event->y)) {
+ GdkRectangle area;
+
+ if (get_caret_cursor_area (view, view->cursor_page, view->cursor_offset, &area))
+ view->cursor_line_offset = area.x;
+ }
if (view->selection_info.in_drag) {
clear_selection (view);
@@ -5302,6 +5312,13 @@ ev_view_move_cursor (EvView *view,
if (!get_caret_cursor_area (view, view->cursor_page, view->cursor_offset, &rect))
return TRUE;
+ if (step == GTK_MOVEMENT_DISPLAY_LINES) {
+ position_caret_cursor_at_location (view, view->cursor_line_offset,
+ rect.y + (rect.height / 2));
+ } else {
+ view->cursor_line_offset = rect.x;
+ }
+
rect.x += view->scroll_x;
rect.y += view->scroll_y;