diff options
author | Matthias Clasen <mclasen@redhat.com> | 2015-09-01 01:04:53 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2015-09-01 01:04:53 -0400 |
commit | e50c37c8a3e7eebdf0bb5cc7b2cd2d2e181aae49 (patch) | |
tree | eb5d4f21683ef95c26a7c409c0fd671609c334d1 /gtk | |
parent | b3a3e91f024785b36247ede0c524520e1f9242c7 (diff) | |
download | gtk+-e50c37c8a3e7eebdf0bb5cc7b2cd2d2e181aae49.tar.gz |
Revert "GtkTextView: various scroll fixes"
This reverts commit 016f6596e76a69844d2832cba07e10d9b60a2b28.
Pushed prematurely by accident.
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtktextview.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index 3d43cc1eb9..52726507bc 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -2281,7 +2281,7 @@ _gtk_text_view_scroll_to_iter (GtkTextView *text_view, screen_inner_bottom = screen.y + screen.height - within_margin_yoffset; buffer_bottom = priv->height - priv->bottom_border; - buffer_right = priv->width - priv->right_margin - priv->left_padding - 1; + buffer_right = priv->width - priv->right_margin; screen_dest.x = screen.x; screen_dest.y = screen.y; @@ -2325,21 +2325,21 @@ _gtk_text_view_scroll_to_iter (GtkTextView *text_view, if (cursor.y == 0) border_yoffset = (with_border) ? priv->top_padding : 0; - screen_dest.y = cursor.y - MAX (within_margin_yoffset, border_yoffset); + screen_dest.y = cursor.y + priv->top_border - MAX (within_margin_yoffset, border_yoffset); } else if (cursor_bottom > screen_inner_bottom) { if (cursor_bottom == buffer_bottom - priv->top_border) border_yoffset = (with_border) ? priv->bottom_padding : 0; - screen_dest.y = cursor_bottom - screen_dest.height + + screen_dest.y = cursor_bottom - screen_dest.height + priv->top_border + MAX (within_margin_yoffset, border_yoffset); } } if (screen_dest.y != screen.y) { - gtk_adjustment_animate_to_value (priv->vadjustment, screen_dest.y + priv->top_border); + gtk_adjustment_animate_to_value (priv->vadjustment, screen_dest.y); DV (g_print (" vert increment %d\n", screen_dest.y - screen.y)); } @@ -2361,28 +2361,29 @@ _gtk_text_view_scroll_to_iter (GtkTextView *text_view, if (cursor.x < screen_inner_left) { if (cursor.x == priv->left_margin) - border_xoffset = (with_border) ? priv->left_padding : 0; + border_xoffset = (with_border) ? 0 : priv->left_padding; screen_dest.x = cursor.x - MAX (within_margin_xoffset, border_xoffset); } - else if (cursor_right >= screen_inner_right - 1) + else if (cursor_right > screen_inner_right) { - if (cursor.x >= buffer_right - priv->right_padding) - border_xoffset = (with_border) ? priv->right_padding : 0; + if (cursor.x == buffer_right) + border_xoffset = (with_border) ? priv->left_border : priv->left_padding; screen_dest.x = cursor_right - screen_dest.width + - MAX (within_margin_xoffset, border_xoffset) + 1; + MAX (within_margin_xoffset, border_xoffset); } } if (screen_dest.x != screen.x) { - gtk_adjustment_animate_to_value (priv->hadjustment, screen_dest.x + priv->left_padding); + gtk_adjustment_animate_to_value (priv->hadjustment, screen_dest.x); DV (g_print (" horiz increment %d\n", screen_dest.x - screen.x)); } - retval = (screen.y != screen_dest.y) || (screen.x != screen_dest.x); + retval = (screen.y != gtk_adjustment_get_value (priv->vadjustment)) + || (screen.x != gtk_adjustment_get_value (priv->hadjustment)); DV(g_print (">%s ("G_STRLOC")\n", retval ? "Actually scrolled" : "Didn't end up scrolling")); @@ -8712,8 +8713,8 @@ gtk_text_view_value_changed (GtkAdjustment *adjustment, if (adjustment == priv->hadjustment) { - dx = priv->xoffset - (gint)gtk_adjustment_get_value (adjustment); - priv->xoffset = (gint)gtk_adjustment_get_value (adjustment) - priv->left_padding; + dx = priv->xoffset - gtk_adjustment_get_value (adjustment); + priv->xoffset = gtk_adjustment_get_value (adjustment) - priv->left_padding; /* If the change is due to a size change we need * to invalidate the entire text window because there might be @@ -8729,8 +8730,8 @@ gtk_text_view_value_changed (GtkAdjustment *adjustment, } else if (adjustment == priv->vadjustment) { - dy = priv->yoffset - (gint)gtk_adjustment_get_value (adjustment) + priv->top_border ; - priv->yoffset -= dy; + dy = priv->yoffset - gtk_adjustment_get_value (adjustment); + priv->yoffset = gtk_adjustment_get_value (adjustment) - priv->top_border; if (priv->layout) { |