[gnome-builder/wip/gtk4-port] plugins/omni-gutter: track highlight current-line changes



commit 54c9cc0486e6768e780fcd4aa0c3510d4d36d277
Author: Christian Hergert <chergert redhat com>
Date:   Mon May 2 13:15:44 2022 -0700

    plugins/omni-gutter: track highlight current-line changes
    
    This fixes the issue now that we turn off current line highlights while
    the view is not focused causing a "bump" where the line would be.

 src/plugins/omni-gutter/gbp-omni-gutter-renderer.c | 13 +++++++++++--
 1 file changed, 11 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 031d928df..ed944e66c 100644
--- a/src/plugins/omni-gutter/gbp-omni-gutter-renderer.c
+++ b/src/plugins/omni-gutter/gbp-omni-gutter-renderer.c
@@ -1276,7 +1276,12 @@ gbp_omni_gutter_renderer_snapshot_line (GtkSourceGutterRenderer *renderer,
       gboolean has_breakpoint = FALSE;
       gboolean bold = FALSE;
 
-      if (!self->draw_has_selection && is_cursor)
+      /* Fill in gap for what would look like the "highlight-current-line"
+       * within the textarea that we are pretending to look like.
+       */
+      if (highlight_line &&
+          !self->draw_has_selection &&
+          is_cursor)
         gtk_snapshot_append_color (snapshot,
                                    &self->current_line,
                                    &GRAPHENE_RECT_INIT (width - RIGHT_MARGIN - CHANGE_WIDTH, line_y,
@@ -1294,7 +1299,7 @@ gbp_omni_gutter_renderer_snapshot_line (GtkSourceGutterRenderer *renderer,
                                    &GRAPHENE_RECT_INIT (0, line_y, width, line_height));
       else if (highlight_line &&
                !self->draw_has_selection &&
-               gtk_source_gutter_lines_is_cursor (lines, line))
+               is_cursor)
         gtk_snapshot_append_color (snapshot,
                                    &self->current.bg,
                                    &GRAPHENE_RECT_INIT (0, line_y, width - RIGHT_MARGIN, line_height));
@@ -1788,6 +1793,10 @@ gbp_omni_gutter_renderer_init (GbpOmniGutterRenderer *self)
                                     "notify::font-desc",
                                     G_CALLBACK (gbp_omni_gutter_renderer_notify_font_desc),
                                     self);
+  ide_signal_group_connect_swapped (self->view_signals,
+                                    "notify::highlight-current-line",
+                                    G_CALLBACK (gtk_widget_queue_draw),
+                                    self);
 }
 
 GbpOmniGutterRenderer *


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