[gnome-builder/wip/gtk4-port: 820/1774] plugins/omni-gutter: add margin to omni gutter
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port: 820/1774] plugins/omni-gutter: add margin to omni gutter
- Date: Mon, 11 Jul 2022 22:31:25 +0000 (UTC)
commit 85ea0cf20295617d8e42918eb1c25d4d36122f96
Author: Christian Hergert <chergert redhat com>
Date: Fri Apr 29 20:01:05 2022 -0700
plugins/omni-gutter: add margin to omni gutter
Since we can't really do this with the text view, we can do it from the
margin for now. However, we still need to tweak how we draw the background
for that space, but that can happen later.
src/plugins/omni-gutter/gbp-omni-gutter-renderer.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/src/plugins/omni-gutter/gbp-omni-gutter-renderer.c
b/src/plugins/omni-gutter/gbp-omni-gutter-renderer.c
index 7d2c35413..e1bc59216 100644
--- a/src/plugins/omni-gutter/gbp-omni-gutter-renderer.c
+++ b/src/plugins/omni-gutter/gbp-omni-gutter-renderer.c
@@ -52,6 +52,7 @@
* Since: 3.32
*/
+#define RIGHT_MARGIN 4
#define CHANGE_WIDTH 2
#define DELETE_WIDTH 5
#define DELETE_HEIGHT 2
@@ -805,6 +806,9 @@ gbp_omni_gutter_renderer_measure (GbpOmniGutterRenderer *self)
if (self->show_line_changes)
size += CHANGE_WIDTH + 2;
+ /* Extra margin */
+ size += RIGHT_MARGIN;
+
if (size != old_width)
{
/* Update the size and ensure we are re-drawn */
@@ -941,7 +945,7 @@ gbp_omni_gutter_renderer_begin (GtkSourceGutterRenderer *renderer,
/* Create a new layout for rendering lines to */
self->layout = gtk_widget_create_pango_layout (GTK_WIDGET (self), "");
pango_layout_set_alignment (self->layout, PANGO_ALIGN_RIGHT);
- pango_layout_set_width (self->layout, (width - BREAKPOINT_XPAD - 4) * PANGO_SCALE);
+ pango_layout_set_width (self->layout, (width - BREAKPOINT_XPAD - RIGHT_MARGIN - 4) * PANGO_SCALE);
}
static gboolean
@@ -1251,7 +1255,7 @@ gbp_omni_gutter_renderer_snapshot_line (GtkSourceGutterRenderer *renderer,
* breakpoint arrows.
*/
if (self->show_line_changes && IS_LINE_CHANGE (info))
- draw_line_change (self, snapshot, line_y, width, line_height, active, info);
+ draw_line_change (self, snapshot, line_y, width - RIGHT_MARGIN, line_height, active, info);
/* Draw breakpoint arrows if we have any breakpoints that could
* potentially match.
@@ -1260,7 +1264,7 @@ gbp_omni_gutter_renderer_snapshot_line (GtkSourceGutterRenderer *renderer,
{
has_breakpoint = IS_BREAKPOINT (info);
if (has_breakpoint || active)
- draw_breakpoint_bg (self, snapshot, line_y, width, line_height, active, info);
+ draw_breakpoint_bg (self, snapshot, line_y, width - RIGHT_MARGIN, line_height, active, info);
}
/* Now that we might have an altered background for the line,
@@ -1268,7 +1272,7 @@ gbp_omni_gutter_renderer_snapshot_line (GtkSourceGutterRenderer *renderer,
* color for symbolic icon).
*/
if (self->show_line_diagnostics && IS_DIAGNOSTIC (info))
- draw_diagnostic (self, snapshot, line_y, width, line_height, active, info);
+ draw_diagnostic (self, snapshot, line_y, width - RIGHT_MARGIN, line_height, active, info);
/*
* Now draw the line numbers if we are showing them. Ensure
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]