Blob Blame History Raw
From a30186cab6a8df054aee7b71b10574fde1be557b Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Tue, 7 May 2019 18:16:56 +0900
Subject: [PATCH] client/gtk2: Keep preedit cursor_pos and visible in clearing
 preedit text

Clear the preedit_string but keep the preedit_cursor_pos and
preedit_visible because a time lag could happen, firefox commit
the preedit text before the preedit text is cleared and it cause
a double commits of the Hangul preedit in firefox if the preedit
would be located on the URL bar and click on anywhere of firefox
out of the URL bar.
---
 client/gtk2/ibusimcontext.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c
index 264a747a..5e3457ba 100644
--- a/client/gtk2/ibusimcontext.c
+++ b/client/gtk2/ibusimcontext.c
@@ -881,10 +881,18 @@ ibus_im_context_clear_preedit_text (IBusIMContext *ibusimcontext)
         ibusimcontext->preedit_mode == IBUS_ENGINE_PREEDIT_COMMIT) {
         preedit_string = g_strdup (ibusimcontext->preedit_string);
     }
+
+    /* Clear the preedit_string but keep the preedit_cursor_pos and
+     * preedit_visible because a time lag could happen, firefox commit
+     * the preedit text before the preedit text is cleared and it cause
+     * a double commits of the Hangul preedit in firefox if the preedit
+     * would be located on the URL bar and click on anywhere of firefox
+     * out of the URL bar.
+     */
     _ibus_context_update_preedit_text_cb (ibusimcontext->ibuscontext,
                                           ibus_text_new_from_string (""),
-                                          0,
-                                          FALSE,
+                                          ibusimcontext->preedit_cursor_pos,
+                                          ibusimcontext->preedit_visible,
                                           IBUS_ENGINE_PREEDIT_CLEAR,
                                           ibusimcontext);
     if (preedit_string) {
-- 
2.20.1