summaryrefslogtreecommitdiff
path: root/gtk/gtktextview.c
diff options
context:
space:
mode:
authorneyfag <11970-neyfag@users.noreply.gitlab.gnome.org>2020-07-30 15:52:57 +0200
committerneyfag <11970-neyfag@users.noreply.gitlab.gnome.org>2020-07-30 15:52:57 +0200
commita27c3039d0a20c6ec4e9fba1fe1b5437a65b834a (patch)
tree09e706868c3a566219318fefaafe699b5d1d500e /gtk/gtktextview.c
parent0ee3370afce83e5e24f96f077cc65cbe6ea4455f (diff)
downloadgtk+-a27c3039d0a20c6ec4e9fba1fe1b5437a65b834a.tar.gz
Scroll to cursor after canceling a selection
Diffstat (limited to 'gtk/gtktextview.c')
-rw-r--r--gtk/gtktextview.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index f59b259277..473d9fb10f 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -6335,26 +6335,22 @@ gtk_text_view_move_cursor (GtkTextView *text_view,
*/
move_cursor (text_view, &newplace, extend_selection);
- if (!gtk_text_iter_equal (&insert, &newplace))
- {
- DV(g_print (G_STRLOC": scrolling onscreen\n"));
- gtk_text_view_scroll_mark_onscreen (text_view,
- gtk_text_buffer_get_insert (get_buffer (text_view)));
+ DV(g_print (G_STRLOC": scrolling onscreen\n"));
+ gtk_text_view_scroll_mark_onscreen (text_view,
+ gtk_text_buffer_get_insert (get_buffer (text_view)));
- if (step == GTK_MOVEMENT_DISPLAY_LINES)
- gtk_text_view_set_virtual_cursor_pos (text_view, cursor_x_pos, -1);
- }
- else if (leave_direction != (GtkDirectionType)-1)
+ if (step == GTK_MOVEMENT_DISPLAY_LINES)
+ gtk_text_view_set_virtual_cursor_pos (text_view, cursor_x_pos, -1);
+
+ if (gtk_text_iter_equal (&insert, &newplace))
{
- if (!gtk_widget_keynav_failed (GTK_WIDGET (text_view),
- leave_direction))
+ if (leave_direction != (GtkDirectionType)-1)
{
- g_signal_emit_by_name (text_view, "move-focus", leave_direction);
+ if (!gtk_widget_keynav_failed (GTK_WIDGET (text_view), leave_direction))
+ g_signal_emit_by_name (text_view, "move-focus", leave_direction);
}
- }
- else if (! cancel_selection)
- {
- gtk_widget_error_bell (GTK_WIDGET (text_view));
+ else if (!cancel_selection)
+ gtk_widget_error_bell (GTK_WIDGET (text_view));
}
gtk_text_view_check_cursor_blink (text_view);