diff --git a/src/engine.c b/src/engine.c index 85c4074..12a48d6 100644 --- a/src/engine.c +++ b/src/engine.c @@ -22,6 +22,7 @@ #include #endif +#include #include #include #include @@ -217,6 +218,11 @@ static int initial_input_mode = INPUT_MODE_LATIN; * whether to use event forwarding workaround */ static gboolean use_event_forwarding = TRUE; +/** + * whether to use client commit + * See: https://github.com/libhangul/ibus-hangul/pull/68 + */ +static gboolean use_client_commit = TRUE; static glong ucschar_strlen (const ucschar* str) @@ -1351,7 +1357,17 @@ ibus_hangul_engine_reset (IBusEngine *engine) { IBusHangulEngine *hangul = (IBusHangulEngine *) engine; + if (use_client_commit) { + // ibus-hangul uses + // ibus_engine_update_preedit_text_with_mode() function which makes + // the preedit string committed automatically when the reset is received + // So we don't need to commit the preedit here. + hangul_ic_reset (hangul->context); + ustring_clear (hangul->preedit); + } + ibus_hangul_engine_flush (hangul); + IBUS_ENGINE_CLASS (parent_class)->reset (engine); }