summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2018-05-14 13:03:34 +0100
committerMatthias Clasen <mclasen@redhat.com>2018-05-14 13:03:34 +0100
commit71718b9cd1ee239b25ae5df9ef8795d309dbc028 (patch)
tree651e98506a2755050cedb363e08080a00f8a1181
parent14e5218753dbf0c440ea00a7269e25869df4ae7d (diff)
downloadgtk+-71718b9cd1ee239b25ae5df9ef8795d309dbc028.tar.gz
textview: Don't scroll for pastes in another viewpaste-scrolling
GtkTextView scrolls to the insertion point when the text buffer signals a paste is done. This is wrong when there are multiple views on the same buffer, and the paste happened in another view. To fix this, flip the handling of the scroll_after_paste boolean to only be TRUE if we know that we want to scroll.
-rw-r--r--gtk/gtktextview.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 6d6a72dcee..1992d4c3b9 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -1639,7 +1639,7 @@ gtk_text_view_init (GtkTextView *text_view)
priv->tabs = NULL;
priv->editable = TRUE;
- priv->scroll_after_paste = TRUE;
+ priv->scroll_after_paste = FALSE;
gtk_drag_dest_set (widget, 0, NULL,
GDK_ACTION_COPY | GDK_ACTION_MOVE);
@@ -5116,10 +5116,6 @@ gtk_text_view_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
else if (button == GDK_BUTTON_MIDDLE &&
get_middle_click_paste (text_view))
{
- /* We do not want to scroll back to the insert iter when we paste
- with the middle button */
- priv->scroll_after_paste = FALSE;
-
get_iter_from_gesture (text_view, GTK_GESTURE (gesture),
&iter, NULL, NULL);
gtk_text_buffer_paste_clipboard (get_buffer (text_view),
@@ -6599,6 +6595,8 @@ gtk_text_view_paste_clipboard (GtkTextView *text_view)
{
GdkClipboard *clipboard = gtk_widget_get_clipboard (GTK_WIDGET (text_view));
+ text_view->priv->scroll_after_paste = TRUE;
+
gtk_text_buffer_paste_clipboard (get_buffer (text_view),
clipboard,
NULL,
@@ -6621,7 +6619,7 @@ gtk_text_view_paste_done_handler (GtkTextBuffer *buffer,
gtk_text_view_scroll_mark_onscreen (text_view, gtk_text_buffer_get_insert (buffer));
}
- priv->scroll_after_paste = TRUE;
+ priv->scroll_after_paste = FALSE;
}
static void