diff options
author | Carlos Garcia Campos <[email protected]> | 2013-07-12 15:26:44 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2017-09-06 18:25:34 +0200 |
commit | a00be8874ae4b62d85909c87b011b4f1915703a1 (patch) | |
tree | 97898ee2053afb5889fc941f51da587eeaf29173 /libview/ev-view.c | |
parent | f132131165bd5b589b7860cce4b190247b2ee83f (diff) | |
download | atril-a00be8874ae4b62d85909c87b011b4f1915703a1.tar.bz2 atril-a00be8874ae4b62d85909c87b011b4f1915703a1.tar.xz |
libview: Use error bell and return early when moving between lines fails
origin commit:
https://git.gnome.org/browse/evince/commit/?h=gnome-3-10&id=3666096
Diffstat (limited to 'libview/ev-view.c')
-rw-r--r-- | libview/ev-view.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/libview/ev-view.c b/libview/ev-view.c index 19016061..f2f8d0e8 100644 --- a/libview/ev-view.c +++ b/libview/ev-view.c @@ -5325,7 +5325,7 @@ ev_view_move_cursor (EvView *view, GdkRectangle rect; gint prev_offset; gint prev_page; - gboolean clearing_selections = FALSE; + gboolean clear_selections = FALSE; if (!view->caret_enabled || view->rotation != 0) return FALSE; @@ -5336,11 +5336,11 @@ ev_view_move_cursor (EvView *view, prev_offset = view->cursor_offset; prev_page = view->cursor_page; + clear_selections = !extend_selection && view->selection_info.selections != NULL; + switch (step) { case GTK_MOVEMENT_VISUAL_POSITIONS: - if (!extend_selection && cursor_clear_selection (view, count > 0)) { - clearing_selections = TRUE; - } else { + if (!clear_selections || !cursor_clear_selection (view, count > 0)) { while (count > 0) { cursor_forward_char (view); count--; @@ -5384,7 +5384,7 @@ ev_view_move_cursor (EvView *view, ev_view_pend_cursor_blink (view); /* Notify the user that it was not possible to move the caret cursor */ - if (!clearing_selections && + if (!clear_selections && prev_offset == view->cursor_offset && prev_page == view->cursor_page) { gtk_widget_error_bell (GTK_WIDGET (view)); return TRUE; @@ -5398,6 +5398,11 @@ ev_view_move_cursor (EvView *view, position_caret_cursor_at_location (view, MAX (rect.x, view->cursor_line_offset), rect.y + (rect.height / 2)); + if (!clear_selections && + prev_offset == view->cursor_offset && prev_page == view->cursor_page) { + gtk_widget_error_bell (GTK_WIDGET (view)); + return TRUE; + } } else { view->cursor_line_offset = rect.x; } @@ -5425,7 +5430,7 @@ ev_view_move_cursor (EvView *view, end_point.y = rect.y + rect.height / 2; extend_selection_from_cursor (view, &start_point, &end_point); - } else + } else if (clear_selections) clear_selection (view); gtk_widget_queue_draw (GTK_WIDGET (view)); |