summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2022-09-06 21:55:13 +0200
committerCarlos Garnacho <carlosg@gnome.org>2022-09-06 22:17:40 +0200
commit5b78fe2721222fabbff245e6249cc8fe89957f1a (patch)
tree58637f35cc5a6314d41dd5a661ef7f58bdc12b73
parent7c0a395ff9443ad4d59fa50c64962b204f4c0e62 (diff)
downloadgtk+-5b78fe2721222fabbff245e6249cc8fe89957f1a.tar.gz
gtktextview: 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.
-rw-r--r--gtk/gtktextview.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 1684b3288e..2e600e01bb 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -8695,8 +8695,9 @@ gtk_text_view_delete_surrounding_handler (GtkIMContext *context,
gtk_text_iter_forward_chars (&start, offset);
gtk_text_iter_forward_chars (&end, offset + n_chars);
- gtk_text_buffer_delete_interactive (priv->buffer, &start, &end,
- priv->editable);
+ if (gtk_text_buffer_delete_interactive (priv->buffer, &start, &end,
+ priv->editable))
+ gtk_im_context_reset (context);
return TRUE;
}