[gtk/gtk-4-6: 6/15] gtktextview: Also reset IM context after IM surrounding text deletion




commit 1a459c5dcd7ba162c7a01a2a33b5a605d3f3f0cf
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Sep 6 21:55:13 2022 +0200

    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.

 gtk/gtktextview.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 06f61eaab5..b587f7a96f 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -8687,8 +8687,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;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]