gtktext: Also reset IM context after IM surrounding text deletion

When the IM commands the GtkText to delete text, the cursor position
would change, and so would the surrounding text. Reset the IM context
so that these updates are properly picked up by the IM.

Fixes backspace key behavior in the GNOME Shell OSK, since that relies
on the surrounding text being properly updated for the next iteration.
This commit is contained in:
Carlos Garnacho 2022-09-06 21:53:25 +02:00
parent 41f26975a9
commit 7c0a395ff9

View File

@ -4298,9 +4298,12 @@ gtk_text_delete_surrounding_cb (GtkIMContext *context,
GtkTextPrivate *priv = gtk_text_get_instance_private (self);
if (priv->editable)
gtk_editable_delete_text (GTK_EDITABLE (self),
priv->current_pos + offset,
priv->current_pos + offset + n_chars);
{
gtk_editable_delete_text (GTK_EDITABLE (self),
priv->current_pos + offset,
priv->current_pos + offset + n_chars);
gtk_im_context_reset (context);
}
return TRUE;
}