[gtksourceview] completioncell: fix splicing of PangoAttrLists



commit 044847a1ba5531e7a3a51611435012724476ff01
Author: Christian Hergert <chergert redhat com>
Date:   Wed Sep 14 20:47:10 2022 -0700

    completioncell: fix splicing of PangoAttrLists
    
    We need to provide the length or we wont properly join the strings in all
    cases here.

 gtksourceview/gtksourcecompletioncell.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/gtksourceview/gtksourcecompletioncell.c b/gtksourceview/gtksourcecompletioncell.c
index c51e9d7b..6fa026b8 100644
--- a/gtksourceview/gtksourcecompletioncell.c
+++ b/gtksourceview/gtksourcecompletioncell.c
@@ -318,12 +318,17 @@ gtk_source_completion_cell_set_text_with_attributes (GtkSourceCompletionCell *se
 
        gtk_source_completion_cell_set_text (self, text);
 
+       if (text == NULL)
+       {
+               return;
+       }
+
        if (attrs != NULL)
        {
                if (self->attrs != NULL)
                {
                        PangoAttrList *copy = pango_attr_list_copy (self->attrs);
-                       pango_attr_list_splice (copy, attrs, 0, 0);
+                       pango_attr_list_splice (copy, attrs, 0, g_utf8_strlen (text, -1));
                        gtk_label_set_attributes (GTK_LABEL (self->child), copy);
                        g_clear_pointer (&copy, pango_attr_list_unref);
                }


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