label: Fix mnemonic handling

We were not handling the case right in which we
want to use underlines, but not use markup. Since
we are now using pango_parse_markup for this case,
we need to escape the xml markup.

Fixes: #4041
This commit is contained in:
Matthias Clasen 2021-06-15 13:06:10 -04:00
parent a3882763d8
commit c4a2234a28

View File

@ -2981,8 +2981,18 @@ gtk_label_recalculate (GtkLabel *self)
gtk_label_clear_layout (self);
gtk_label_clear_select_info (self);
if (self->use_markup || self->use_underline)
gtk_label_set_markup_internal (self, self->label, self->use_underline);
if (self->use_markup)
{
gtk_label_set_markup_internal (self, self->label, self->use_underline);
}
else if (self->use_underline)
{
char *text;
text = g_markup_escape_text (self->label, -1);
gtk_label_set_markup_internal (self, text, TRUE);
g_free (text);
}
else
{
g_clear_pointer (&self->markup_attrs, pango_attr_list_unref);