[gnome-builder] omni-gutter: render tick for initial deleted lines



commit 171a4425dff70a3694e193ccc7b501769c4fc6e7
Author: Christian Hergert <chergert redhat com>
Date:   Sun Jan 27 11:52:36 2019 -0800

    omni-gutter: render tick for initial deleted lines
    
    Fixes #788

 src/plugins/omni-gutter/gbp-omni-gutter-renderer.c | 24 ++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/src/plugins/omni-gutter/gbp-omni-gutter-renderer.c 
b/src/plugins/omni-gutter/gbp-omni-gutter-renderer.c
index efcdfec3d..6b8fefe70 100644
--- a/src/plugins/omni-gutter/gbp-omni-gutter-renderer.c
+++ b/src/plugins/omni-gutter/gbp-omni-gutter-renderer.c
@@ -507,12 +507,13 @@ populate_changes_cb (guint               line,
   info->is_add = !!(change & IDE_BUFFER_LINE_CHANGE_ADDED);
   info->is_change = !!(change & IDE_BUFFER_LINE_CHANGE_CHANGED);
   info->is_delete = !!(change & IDE_BUFFER_LINE_CHANGE_DELETED);
+  info->is_prev_delete = !!(change & IDE_BUFFER_LINE_CHANGE_PREVIOUS_DELETED);
 
   if (pos > 0)
     {
       LineInfo *last = &g_array_index (state->lines, LineInfo, pos - 1);
 
-      info->is_prev_delete = last->is_delete;
+      info->is_prev_delete |= last->is_delete;
       last->is_next_delete = info->is_delete;
     }
 }
@@ -985,6 +986,7 @@ draw_line_change (GbpOmniGutterRenderer        *self,
                   cairo_t                      *cr,
                   GdkRectangle                 *area,
                   LineInfo                     *info,
+                  guint                         line,
                   GtkSourceGutterRendererState  state)
 {
   g_assert (GBP_IS_OMNI_GUTTER_RENDERER (self));
@@ -1012,6 +1014,24 @@ draw_line_change (GbpOmniGutterRenderer        *self,
       cairo_fill (cr);
     }
 
+  if (line == 0 && info->is_prev_delete)
+    {
+      cairo_move_to (cr,
+                     area->x + area->width,
+                     area->y);
+      cairo_line_to (cr,
+                     area->x + area->width - DELETE_WIDTH,
+                     area->y + DELETE_HEIGHT / 2);
+      cairo_line_to (cr,
+                     area->x + area->width - DELETE_WIDTH,
+                     area->y);
+      cairo_line_to (cr,
+                     area->x + area->width,
+                     area->y);
+      gdk_cairo_set_source_rgba (cr, &self->changes.remove);
+      cairo_fill (cr);
+    }
+
   if (info->is_next_delete && !info->is_delete)
     {
       cairo_move_to (cr,
@@ -1162,7 +1182,7 @@ gbp_omni_gutter_renderer_draw (GtkSourceGutterRenderer      *renderer,
        * breakpoint arrows.
        */
       if (self->show_line_changes && IS_LINE_CHANGE (info))
-        draw_line_change (self, cr, cell_area, info, state);
+        draw_line_change (self, cr, cell_area, info, line, state);
 
       /* Draw breakpoint arrows if we have any breakpoints that could
        * potentially match.


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