I encountered a problem when using g_object_set ("background") together with text markup that sets fore- and background color of text inside a tree view cell. If I do this, if the highlighted text starts at the beginning of the cell or spans the whole cell, the foreground color is ignored.
I'll give you a code example and a screenshot to clarify this:
First I set the background color for the whole cell:
g_object_set (txt_renderer, "background", "#364074", "background-set", TRUE);
So far everything is alright, now I want to highlight some part of the cell, since this is part of a search functionality:
highlighted_txt = g_strconcat ("<span background=\"yellow\" foreground=\"black\">", match, "</span>", NULL));
g_object_set (txt_renderer, "markup", highlighted_txt, NULL);
But if the highlighted text is identical to the whole text of the cell or it starts at the beginning of it, the foreground color setting is ignored. I have included a screenshot to show this effect.
Actually the whole real code behind creating the markup is done by a modified version of the example code listed at the glib docu page for g_regex_replace_eval, but the generated markup text should be correct, it is for example:
<span background="yellow" foreground="black">no</span> content
Am I missing here something regarding usage of <span>?