[gtksourceview/wip/chergert/vim] 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] utils: include top margin in position calculation
- Date: Tue, 26 Oct 2021 05:43:36 +0000 (UTC)
commit 779524ed59298846850f72f0504cade222b0fb0e
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]