From 5e72a48c2c2901139e31554166718a6abdf0d9ac Mon Sep 17 00:00:00 2001 From: Hojun-Cho Date: Sun, 16 Aug 2026 21:28:11 +0900 Subject: [PATCH] engine: Korean and Telex let Enter and Tab through after committing Enter with a pending syllable committed it and stopped there, so a chat message needed Enter twice; Korean input methods commit and pass the key on. Japanese keeps consuming the key that confirms a reading or a chosen candidate, as Japanese input methods do. --- README.md | 8 +++++--- strans.c | 3 ++- tests/engine_test.c | 14 ++++++++------ 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index b437548..08bb295 100644 --- a/README.md +++ b/README.md @@ -19,9 +19,11 @@ Vietnamese Telex is also available as a compatibility mode. Use `Up`/`Down` to move through candidates and `PageUp`/`PageDown` to move by nine without wrapping. An unmodified `1`-`9` selects that row on the current page. `Enter` and `Tab` commit a candidate you have moved to; otherwise they -commit the reading, as `0` always does. In a temporary Emoji or Hanja search, -`Enter` commits the highlighted result and `Tab`/`Shift-Tab` wrap through -the results. `Esc` cancels composition. +commit the reading, as `0` always does. Japanese consumes the confirming key; +Korean and Vietnamese pass it on to the application. 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. 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 24ed2d3..b27aad1 100644 --- a/strans.c +++ b/strans.c @@ -698,7 +698,8 @@ transition(u32int ks, u32int mod, Str *com) if(!haspre(&im)) return 0; flush(com); - return 1; + /* Japanese confirms with the key; Korean and Telex let it on. */ + return isjp(&im); } if(ks == Kback){ if(!haspre(&im)) diff --git a/tests/engine_test.c b/tests/engine_test.c index 73e59bc..6bfe7bb 100644 --- a/tests/engine_test.c +++ b/tests/engine_test.c @@ -56,7 +56,7 @@ vietnamese_state_lifetime(struct ct *t) im.pre = mkstr("as"); im.raw = mkstr("as"); sclear(&com); - CT_CHECK(t, keystroke(Kret, 0, &com)); + CT_CHECK(t, !keystroke(Kret, 0, &com)); checkstr(t, "committed Telex", "á", &com); CT_EQ_INT(t, 0, im.pre.n); CT_EQ_INT(t, 0, im.raw.n); @@ -373,7 +373,7 @@ engine_vietnamese_client_preedit(struct ct *t) redraw(); if(CT_CHECK(t, draindraw(&dc) > 0)) CT_EQ_INT(t, 0, scmp(&dc.pre, &res.preedit)); - CT_CHECK(t, keystroke(Kret, 0, &com)); + CT_CHECK(t, !keystroke(Kret, 0, &com)); checkstr(t, "commit", cases[i].shown, &com); } } @@ -615,7 +615,7 @@ engine_language_switch_state(struct ct *t) { "switch to Vietnamese", 'v', Mctrl, LangVI, "", "", "가", 0 }, { "Vietnamese a again", 'a', 0, LangVI, "a", "a", "", 0 }, { "Vietnamese tone again", 's', 0, LangVI, "as", "as", "", 0 }, - { "commit Vietnamese", Kret, 0, LangVI, "", "", "á", 0 }, + { "commit Vietnamese", 't', Mctrl, LangEN, "", "", "á", 0 }, }; char where[80]; Lang *vi; @@ -730,6 +730,7 @@ static void candidatebegin(int n) { init(); + im.l = getlang(LangJP); draindraw(nil); setcandidates(n); } @@ -887,13 +888,14 @@ engine_candidate_completion(struct ct *t) CT_CHECK(t, keystroke(Kret, 0, &com)); checkstr(t, "Enter without candidates", "reading", &com); + /* A digit with no such row on the page is an ordinary key. */ candidatebegin(32); + im.pre = mkstr("reading"); im.sel = 27; sclear(&com); CT_CHECK(t, !keystroke('9', 0, &com)); - checkstr(t, "unavailable short-page digit", "", &com); - CT_EQ_INT(t, 32, im.nkouho); - CT_EQ_INT(t, 27, im.sel); + checkstr(t, "unavailable short-page digit", "reading", &com); + CT_EQ_INT(t, 0, im.nkouho); } static void