guint state);
static void ibus_hangul_engine_flush (IBusHangulEngine *hangul);
+static void ibus_hangul_engine_clear_preedit_text
+ (IBusHangulEngine *hangul);
static void ibus_hangul_engine_update_preedit_text
(IBusHangulEngine *hangul);
}
static void
+ibus_hangul_engine_clear_preedit_text (IBusHangulEngine *hangul)
+{
+ IBusText *text;
+
+ text = ibus_text_new_from_static_string ("");
+ ibus_engine_update_preedit_text ((IBusEngine *)hangul, text, 0, FALSE);
+}
+
+static void
ibus_hangul_engine_update_preedit_text (IBusHangulEngine *hangul)
{
const ucschar *hic_preedit;
-key_len , key_len);
}
- ibus_hangul_engine_update_preedit_text (hangul);
+ /* clear preedit text before commit */
+ ibus_hangul_engine_clear_preedit_text (hangul);
text = ibus_text_new_from_string (value);
ibus_engine_commit_text ((IBusEngine *)hangul, text);
+
+ ibus_hangul_engine_update_preedit_text (hangul);
}
static gchar*
ustring_append_ucs4 (hangul->preedit, str, -1);
if (ustring_length (hangul->preedit) > 0) {
+ /* clear preedit text before commit */
+ ibus_hangul_engine_clear_preedit_text (hangul);
+
preedit = ustring_begin (hangul->preedit);
text = ibus_text_new_from_ucs4 ((gunichar*)preedit);
ibus_engine_commit_text (engine, text);
}
} else {
if (str != NULL && str[0] != 0) {
- IBusText *text = ibus_text_new_from_ucs4 (str);
+ IBusText *text;
+
+ /* clear preedit text before commit */
+ ibus_hangul_engine_clear_preedit_text (hangul);
+
+ text = ibus_text_new_from_ucs4 (str);
ibus_engine_commit_text (engine, text);
}
}
ustring_append_ucs4 (hangul->preedit, str, -1);
if (ustring_length (hangul->preedit) != 0) {
+ /* clear preedit text before commit */
+ ibus_hangul_engine_clear_preedit_text (hangul);
+
str = ustring_begin (hangul->preedit);
text = ibus_text_new_from_ucs4 (str);