[gtksourceview] map: use left-margin to center primary text region
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc: 
- Subject: [gtksourceview] map: use left-margin to center primary text region
- Date: Mon, 21 Jun 2021 21:39:48 +0000 (UTC)
commit b07c2defa6bc1fe994e30f628a93438c9bfbf3d0
Author: Christian Hergert <chergert redhat com>
Date:   Mon Jun 21 15:02:19 2021 -0700
    map: use left-margin to center primary text region
    
    If the left-margin is set, we can key off that to keep the content somewhat
    centered but with overflow to the right.
    
    This can result in something significantly more aesthetically pleasing.
 gtksourceview/gtksourcemap.c | 5 +++++
 1 file changed, 5 insertions(+)
---
diff --git a/gtksourceview/gtksourcemap.c b/gtksourceview/gtksourcemap.c
index cbd893ff..c2b3549b 100644
--- a/gtksourceview/gtksourcemap.c
+++ b/gtksourceview/gtksourcemap.c
@@ -622,6 +622,11 @@ gtk_source_map_measure (GtkWidget      *widget,
                        g_object_unref (layout);
                        g_free (text);
 
+                       /* If left-margin is set, try to balance the right side with the same amount
+                        * of additional space to keep it aligned.
+                        */
+                       width += (gtk_text_view_get_left_margin (GTK_TEXT_VIEW (map)) * 2);
+
                        *minimum = *natural = width;
                }
        }
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]