[gimp] Bug 767269 - Japanese IM undoes too much.



commit 7b9a7439dc7230d33c7d6fff6789d4494c894516
Author: Jehan <jehan girinstud io>
Date:   Sun Jun 5 21:49:30 2016 +0200

    Bug 767269 - Japanese IM undoes too much.
    
    Japanese IME emits the preedit-commit before preedit-end (Hangul or
    Unicode don't, but we could assume other IMEs may be doing the same).
    As a consequence, the undo step was not pushed, thus breaking undo
    history and consistency.
    The solution is to simulate preediting end then restart when a commit
    happens during preediting.

 app/tools/gimptexttool-editor.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/app/tools/gimptexttool-editor.c b/app/tools/gimptexttool-editor.c
index 6d18e0c..4a0e374 100644
--- a/app/tools/gimptexttool-editor.c
+++ b/app/tools/gimptexttool-editor.c
@@ -1532,9 +1532,21 @@ gimp_text_tool_im_commit (GtkIMContext *context,
                           const gchar  *str,
                           GimpTextTool *text_tool)
 {
+  gboolean preedit_active = text_tool->preedit_active;
+
   gimp_text_tool_im_delete_preedit (text_tool);
 
+  /* Some IMEs would emit a preedit-commit before preedit-end.
+   * To keep undo consistency, we fake and end then immediate restart of
+   * preediting.
+   */
+  if (preedit_active)
+    gimp_text_tool_im_preedit_end (context, text_tool);
+
   gimp_text_tool_enter_text (text_tool, str);
+
+  if (preedit_active)
+    gimp_text_tool_im_preedit_start (context, text_tool);
 }
 
 static gboolean


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