From 63fc60dc06b374d64fb8ff91aab65bc2ee76ffea Mon Sep 17 00:00:00 2001 From: Hojun-Cho Date: Mon, 17 Aug 2026 00:53:43 +0900 Subject: [PATCH] engine: Korean and Telex let Escape through after committing A pending Hangul syllable is real text, and Escape is what vi users press to leave insert mode; eating it and dropping the syllable served nobody. fcitx5-hangul commits and passes any key it does not consume, Escape included; do the same for Korean and Telex. A Japanese reading is still cancelled: there Escape is the IME's own key. --- README.md | 4 +++- strans.c | 2 +- tests/engine_test.c | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a0c4418..f1f92e7 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,9 @@ the application. `Space` on a reading without candidates commits it and types nothing. `Backspace` and `Esc` on a chosen candidate go back to the reading. In a temporary Emoji or Hanja search, `Enter` commits the highlighted result and `Tab`/`Shift-Tab` wrap through the results. Leaving -the field or clicking elsewhere commits what is pending; `Esc` cancels it. +the field or clicking elsewhere commits what is pending. `Esc` cancels a +Japanese reading or a search; in Korean and Vietnamese it commits the +syllable and goes on to the application, so it still leaves insert mode. Hiragana mode composes a complete reading before offering Kanji candidates. Katakana mode does not perform Kanji conversion. Emoji and Hanja searches diff --git a/strans.c b/strans.c index 950ccb5..da368cb 100644 --- a/strans.c +++ b/strans.c @@ -704,7 +704,7 @@ transition(u32int ks, u32int mod, Str *com) flush(com); return 1; } - if(ks == Ktab || ks == Kret){ + if(ks == Ktab || ks == Kret || (ks == Kesc && !isjp(&im))){ if(!haspre(&im)) return 0; flush(com); diff --git a/tests/engine_test.c b/tests/engine_test.c index e0a3560..48fe708 100644 --- a/tests/engine_test.c +++ b/tests/engine_test.c @@ -66,8 +66,8 @@ vietnamese_state_lifetime(struct ct *t) im.pre = mkstr("as"); im.raw = mkstr("as"); sclear(&com); - CT_CHECK(t, keystroke(Kesc, 0, &com)); - CT_EQ_INT(t, 0, com.n); + CT_CHECK(t, !keystroke(Kesc, 0, &com)); + checkstr(t, "Escape commits Telex", "รก", &com); CT_EQ_INT(t, 0, im.pre.n); CT_EQ_INT(t, 0, im.raw.n);