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.
This commit is contained in:
2026-08-16 21:28:11 +09:00
parent 11bf379ad3
commit 5e72a48c2c
3 changed files with 15 additions and 10 deletions

View File

@@ -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 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 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 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, commit the reading, as `0` always does. Japanese consumes the confirming key;
`Enter` commits the highlighted result and `Tab`/`Shift-Tab` wrap through Korean and Vietnamese pass it on to the application. In a temporary Emoji or
the results. `Esc` cancels composition. 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. Hiragana mode composes a complete reading before offering Kanji candidates.
Katakana mode does not perform Kanji conversion. Emoji and Hanja searches Katakana mode does not perform Kanji conversion. Emoji and Hanja searches

View File

@@ -698,7 +698,8 @@ transition(u32int ks, u32int mod, Str *com)
if(!haspre(&im)) if(!haspre(&im))
return 0; return 0;
flush(com); flush(com);
return 1; /* Japanese confirms with the key; Korean and Telex let it on. */
return isjp(&im);
} }
if(ks == Kback){ if(ks == Kback){
if(!haspre(&im)) if(!haspre(&im))

View File

@@ -56,7 +56,7 @@ vietnamese_state_lifetime(struct ct *t)
im.pre = mkstr("as"); im.pre = mkstr("as");
im.raw = mkstr("as"); im.raw = mkstr("as");
sclear(&com); sclear(&com);
CT_CHECK(t, keystroke(Kret, 0, &com)); CT_CHECK(t, !keystroke(Kret, 0, &com));
checkstr(t, "committed Telex", "á", &com); checkstr(t, "committed Telex", "á", &com);
CT_EQ_INT(t, 0, im.pre.n); CT_EQ_INT(t, 0, im.pre.n);
CT_EQ_INT(t, 0, im.raw.n); CT_EQ_INT(t, 0, im.raw.n);
@@ -373,7 +373,7 @@ engine_vietnamese_client_preedit(struct ct *t)
redraw(); redraw();
if(CT_CHECK(t, draindraw(&dc) > 0)) if(CT_CHECK(t, draindraw(&dc) > 0))
CT_EQ_INT(t, 0, scmp(&dc.pre, &res.preedit)); 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); 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 }, { "switch to Vietnamese", 'v', Mctrl, LangVI, "", "", "", 0 },
{ "Vietnamese a again", 'a', 0, LangVI, "a", "a", "", 0 }, { "Vietnamese a again", 'a', 0, LangVI, "a", "a", "", 0 },
{ "Vietnamese tone again", 's', 0, LangVI, "as", "as", "", 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]; char where[80];
Lang *vi; Lang *vi;
@@ -730,6 +730,7 @@ static void
candidatebegin(int n) candidatebegin(int n)
{ {
init(); init();
im.l = getlang(LangJP);
draindraw(nil); draindraw(nil);
setcandidates(n); setcandidates(n);
} }
@@ -887,13 +888,14 @@ engine_candidate_completion(struct ct *t)
CT_CHECK(t, keystroke(Kret, 0, &com)); CT_CHECK(t, keystroke(Kret, 0, &com));
checkstr(t, "Enter without candidates", "reading", &com); checkstr(t, "Enter without candidates", "reading", &com);
/* A digit with no such row on the page is an ordinary key. */
candidatebegin(32); candidatebegin(32);
im.pre = mkstr("reading");
im.sel = 27; im.sel = 27;
sclear(&com); sclear(&com);
CT_CHECK(t, !keystroke('9', 0, &com)); CT_CHECK(t, !keystroke('9', 0, &com));
checkstr(t, "unavailable short-page digit", "", &com); checkstr(t, "unavailable short-page digit", "reading", &com);
CT_EQ_INT(t, 32, im.nkouho); CT_EQ_INT(t, 0, im.nkouho);
CT_EQ_INT(t, 27, im.sel);
} }
static void static void