engine: the digits type until the candidate list is engaged

Every complete reading shows its candidates, so 1-9 were candidate picks
in the middle of composing: ka then 5 committed 家, and heya then 2
typed a 2 the application never asked for.  They pick only once Space,
Tab, or an arrow has chosen a candidate, as in Mozc; before that they are
ordinary keys.  A search is unchanged: its digits pick from the start.
This commit is contained in:
2026-08-17 12:36:23 +09:00
parent cf8eca2ff1
commit c2aec44aa9
3 changed files with 18 additions and 3 deletions

View File

@@ -31,8 +31,8 @@ adjectives SKK keys by stem and okurigana (かく offers 確 and 書く), and
under `Space` the reading in Katakana last, so a word the dictionary lacks
converts to Katakana with one `Space`. `Space` or `Tab` chooses the first
candidate and then steps on, wrapping (with `Shift`, back); `Up`/`Down` and
`PageUp`/`PageDown` move without wrapping. An unmodified `1`-`9` commits
that row of the current page. `Enter` commits the chosen candidate, or the
`PageUp`/`PageDown` move without wrapping. Once a candidate is chosen, an unmodified `1`-`9` commits that row of the
current page; before that the digits type. `Enter` commits the chosen candidate, or the
reading when none is chosen, as `0` always does; so does typing on, or any
key that ends the composition. `Backspace` deletes the last kana shown;
romaji that made no kana stays in the reading as typed until it is mended.

View File

@@ -812,7 +812,8 @@ transition(u32int ks, u32int mod, Str *com)
movekouho(n);
return 1;
}
n = numberedkouho(ks, mod);
/* Digits pick a candidate only once the list has been engaged. */
n = im.sel >= 0 ? numberedkouho(ks, mod) : -1;
if(n >= 0){
sappend(com, &im.kouho[n]);
reset();

View File

@@ -888,6 +888,20 @@ engine_candidate_completion(struct ct *t)
CT_CHECK(t, keystroke(Kret, 0, &com));
checkstr(t, "Enter without candidates", "reading", &com);
/* A digit types on until Space engages the list. */
candidatebegin(3);
im.pre = mkstr("reading");
sclear(&com);
CT_CHECK(t, !keystroke('2', 0, &com));
checkstr(t, "digit before the list is engaged", "reading", &com);
CT_EQ_INT(t, 0, im.nkouho);
candidatebegin(3);
im.pre = mkstr("reading");
sclear(&com);
CT_CHECK(t, keystroke(' ', 0, &com));
CT_CHECK(t, keystroke('2', 0, &com));
checkstr(t, "digit after the list is engaged", "c2", &com);
/* A digit with no such row on the page is an ordinary key: it
* confirms the candidate paged to and passes on. */
candidatebegin(32);