[gtksourceview] gutter: include extra line in gutter range



commit fd3267a2e21f09d28213c298e74da9155ee9816c
Author: Christian Hergert <chergert redhat com>
Date:   Wed Apr 6 13:37:05 2022 -0700

    gutter: include extra line in gutter range
    
    It can be helpful to have an extra line before/below when rendering
    gutter contents so that you can fill in information you need based
    on a single neighboring line.

 gtksourceview/gtksourcegutter.c | 8 ++++++++
 1 file changed, 8 insertions(+)
---
diff --git a/gtksourceview/gtksourcegutter.c b/gtksourceview/gtksourcegutter.c
index e6083a95..4cfc96f2 100644
--- a/gtksourceview/gtksourcegutter.c
+++ b/gtksourceview/gtksourcegutter.c
@@ -722,6 +722,14 @@ gtk_source_gutter_snapshot (GtkWidget   *widget,
                                            visible_rect.x,
                                            visible_rect.y + visible_rect.height);
 
+       /* Try to include an extra line on each edge so that situations
+        * that are dependent on neighboring lines can still include enough
+        * information to draw correctly. This is useful for situations like
+        * git where you might need to draw special delete marks.
+        */
+       gtk_text_iter_backward_line (&begin);
+       gtk_text_iter_forward_line (&end);
+
        /* The first step is to get line information about all the visible
         * lines. We do this up front so that we can do it once to reduce many
         * times the renderers need to walk through the buffer contents as that


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]