[gtk+] GtkTextView: fix margin/padding scroll behaviour
- From: Sebastien Lafargue <slafargue src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] GtkTextView: fix margin/padding scroll behaviour
- Date: Wed, 19 Aug 2015 20:53:01 +0000 (UTC)
commit 8baab8f33d0dd1163152c11b4002967167e7edcd
Author: Sebastien Lafargue <slafargue gnome org>
Date: Wed Aug 19 12:33:06 2015 +0200
GtkTextView: fix margin/padding scroll behaviour
When you move line by line, only padding is
automaticly shown and you need to use Page key to show margin.
This commit also fix cursor going out of the screen bug.
gtk/gtktextview.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 3e59314..1ad4c06 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -2278,7 +2278,7 @@ _gtk_text_view_scroll_to_iter (GtkTextView *text_view,
screen_inner_left = screen.x + within_margin_xoffset;
screen_inner_top = screen.y + within_margin_yoffset;
screen_inner_right = screen.x + screen.width - within_margin_xoffset;
- screen_inner_bottom = screen.y + screen.width - within_margin_yoffset;
+ screen_inner_bottom = screen.y + screen.height - within_margin_yoffset;
buffer_bottom = priv->height - priv->bottom_border;
buffer_right = priv->width - priv->right_margin;
@@ -2325,14 +2325,14 @@ _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)
+ 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);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]