[gtksourceview/wip/chergert/vim: 2/4] utils: include top margin in position calculation
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/chergert/vim: 2/4] utils: include top margin in position calculation
- Date: Fri, 12 Nov 2021 01:20:36 +0000 (UTC)
commit c6358fce0b04db01351d75389a2b6fe3fab22783
Author: Christian Hergert <chergert redhat com>
Date: Mon Oct 25 22:43:19 2021 -0700
utils: include top margin in position calculation
gtksourceview/gtksourceutils.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/gtksourceview/gtksourceutils.c b/gtksourceview/gtksourceutils.c
index e8880289..f79d9d09 100644
--- a/gtksourceview/gtksourceutils.c
+++ b/gtksourceview/gtksourceutils.c
@@ -652,6 +652,7 @@ _gtk_source_view_jump_to_iter (GtkTextView *text_view,
int screen_yoffset;
int current_x_scroll;
int current_y_scroll;
+ int top_margin;
g_return_if_fail (GTK_IS_TEXT_VIEW (text_view));
g_return_if_fail (iter != NULL);
@@ -659,6 +660,8 @@ _gtk_source_view_jump_to_iter (GtkTextView *text_view,
g_return_if_fail (xalign >= 0.0 && xalign <= 1.0);
g_return_if_fail (yalign >= 0.0 && yalign <= 1.0);
+ g_object_get (text_view, "top-margin", &top_margin, NULL);
+
hadj = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE (text_view));
vadj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (text_view));
@@ -753,5 +756,5 @@ _gtk_source_view_jump_to_iter (GtkTextView *text_view,
xvalue += current_x_scroll;
gtk_adjustment_set_value (hadj, xvalue);
- gtk_adjustment_set_value (vadj, yvalue);
+ gtk_adjustment_set_value (vadj, yvalue + top_margin);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]