After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 699060 - [PATCH] cellrenderertext: Fix possible overwriting of markup
[PATCH] cellrenderertext: Fix possible overwriting of markup
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Widget: GtkTreeView
3.10.x
Other Linux
: Normal normal
: ---
Assigned To: gtktreeview-bugs
gtktreeview-bugs
: 755968 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2013-04-27 19:24 UTC by Olivier Brunel (jjacky)
Modified: 2018-04-15 00:02 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
cellrenderertext: Fix possible overwriting of markup (1.14 KB, patch)
2013-04-27 19:24 UTC, Olivier Brunel (jjacky)
none Details | Review
cellrenderertext: Fix possible overwriting of markup (1.13 KB, patch)
2013-10-15 15:33 UTC, Olivier Brunel (jjacky)
none Details | Review

Description Olivier Brunel (jjacky) 2013-04-27 19:24:13 UTC
Created attachment 242676 [details] [review]
cellrenderertext: Fix possible overwriting of markup

When creating the layout, attributes were inserted after existing attributes
with a matching start_index; this could result in some attributes from markup
being ignored/overwritten.

For example, if the markup started with a span setting a color, it would be
overwritten by the foreground property for that section.

Inserting attributes before will ensure markup attributes are preserved.
Comment 1 Olivier Brunel (jjacky) 2013-10-15 15:33:09 UTC
Created attachment 257358 [details] [review]
cellrenderertext: Fix possible overwriting of markup

Updated patch.
Comment 2 Sébastien Wilmet 2015-02-04 17:22:43 UTC
I confirm the bug. The patch still applies to the master branch and works fine for me.

The bug occurs in the completion system of GtkSourceView. We use the :font-desc property to apply the same font as the GtkTextView, and we use the :markup property. When the markup text contains something like "<b>Completion provider header</b>", the bold markup is not applied. With the above patch the text is correctly in bold.

The bug doesn't occur when the markup is not applied to the whole text, so for example "blah <b>foobar</b>" is not affected.

To test the bug, you can launch tests/test-completion in GtkSourceView. Type something in the GtkTextView -> the completion proposals are shown with the headers "Fixed Provider" and "Random Provider". Those headers should be in bold.
Comment 3 Sébastien Wilmet 2015-03-11 12:58:29 UTC
Review of attachment 257358 [details] [review]:

Small review, but take it with a grain of salt since I'm not a GTK+ developer.

::: gtk/gtkcellrenderertext.c
@@ +1578,3 @@
   attr->end_index = G_MAXINT;
   
+  pango_attr_list_insert_before (attr_list, attr);

I guess a comment here to explain why insert_before() is needed would be useful, so it isn't lost in the git history.
Comment 4 Matthias Clasen 2015-03-12 02:12:55 UTC
Hmm, I'm not entirely convinced. The attribute handling code should probably be rewritten to be more similar to the corresponding code in GtkLabel
Comment 5 Matthias Clasen 2016-03-06 17:07:12 UTC
*** Bug 755968 has been marked as a duplicate of this bug. ***
Comment 6 Matthias Clasen 2018-02-10 05:14:23 UTC
We're moving to gitlab! As part of this move, we are moving bugs to NEEDINFO if they haven't seen activity in more than a year. If this issue is still important to you and still relevant with GTK+ 3.22 or master, please reopen it and we will migrate it to gitlab.
Comment 7 Matthias Clasen 2018-04-15 00:02:59 UTC
As announced a while ago, we are migrating to gitlab, and bugs that haven't seen activity in the last year or so will be not be migrated, but closed out in bugzilla.

If this bug is still relevant to you, you can open a new issue describing the symptoms and how to reproduce it with gtk 3.22.x or master in gitlab:

https://gitlab.gnome.org/GNOME/gtk/issues/new