Revert "text: Avoid creating a PangoAttrList we don't need"
This reverts commit 67c2665028.
The splicing we do here has the important side-effect
of shifting the preedit attributes to the right position.
Without it, we end up always underlining the first chars
in the entry, regardless where the preedit happens.
This commit is contained in:
@@ -4354,6 +4354,8 @@ gtk_text_create_layout (GtkText *self,
|
||||
|
||||
tmp_attrs = gtk_css_style_get_pango_attributes (gtk_css_node_get_style (gtk_widget_get_css_node (widget)));
|
||||
tmp_attrs = _gtk_pango_attr_list_merge (tmp_attrs, priv->attrs);
|
||||
if (!tmp_attrs)
|
||||
tmp_attrs = pango_attr_list_new ();
|
||||
|
||||
display_text = gtk_text_get_display_text (self, 0, -1);
|
||||
|
||||
@@ -4374,10 +4376,7 @@ gtk_text_create_layout (GtkText *self,
|
||||
pos = g_utf8_offset_to_pointer (display_text, priv->current_pos) - display_text;
|
||||
g_string_insert (tmp_string, pos, preedit_string);
|
||||
pango_layout_set_text (layout, tmp_string->str, tmp_string->len);
|
||||
if (tmp_attrs)
|
||||
pango_attr_list_splice (tmp_attrs, preedit_attrs, pos, preedit_length);
|
||||
else
|
||||
tmp_attrs = pango_attr_list_ref (preedit_attrs);
|
||||
pango_attr_list_splice (tmp_attrs, preedit_attrs, pos, preedit_length);
|
||||
g_string_free (tmp_string, TRUE);
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user