[gtksourceview] gutterrenderer: handle possible negative values



commit dc19c014fc2f46317a1741b81d64e3fa0242335c
Author: Christian Hergert <chergert redhat com>
Date:   Tue Oct 19 14:17:54 2021 -0700

    gutterrenderer: handle possible negative values
    
    Fixes a situation where we might actually have a reversed value for
    align of 1.0 than 0.0.

 gtksourceview/gtksourcegutterrenderer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gtksourceview/gtksourcegutterrenderer.c b/gtksourceview/gtksourcegutterrenderer.c
index 27f453f7..df0881d8 100644
--- a/gtksourceview/gtksourcegutterrenderer.c
+++ b/gtksourceview/gtksourcegutterrenderer.c
@@ -780,8 +780,8 @@ gtk_source_gutter_renderer_align_cell (GtkSourceGutterRenderer *renderer,
 
        get_line_rect (renderer, line, &rect);
 
-       *x = rect.x + (rect.width - width) * priv->xalign;
-       *y = rect.y + (rect.height - height) * priv->yalign;
+       *x = rect.x + MAX (0, (rect.width - width)) * priv->xalign;
+       *y = rect.y + MAX (0, (rect.height - height)) * priv->yalign;
 }
 
 /**


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