engine: no candidate is chosen until the user moves to one; Space converts

A complete Japanese reading showed its candidates with the first row
highlighted, yet Enter committed the reading unless the user had moved
to a candidate: the highlight lied.  Now sel is -1 while nothing is
chosen, and it alone says what Enter commits; candidatechosen goes.

Every key that ends a composition — Enter, Tab, a language switch, a
special key, a modifier chord, typing on — now commits the chosen
candidate through one flush; before, only Enter and Tab did, and Ctrl+S
after choosing 漢字 committed かんじ.

Space in a Japanese mode is the conversion key, as in every other
Japanese IME: it steps through the candidates (Shift+Space backwards,
both wrapping) and commits a reading that has none, without typing a
space.  Backspace and Escape on a chosen candidate go back to the
reading first.  Tab in a search wraps through the same cyclekouho.

reset() no longer forgets the caret: a chosen candidate confirmed by
typing on would otherwise redraw the next reading at the pointer.
This commit is contained in:
2026-08-17 00:52:50 +09:00
parent ea363ca792
commit e8519b4e06
3 changed files with 148 additions and 100 deletions

View File

@@ -16,14 +16,18 @@ Vietnamese Telex is also available as a compatibility mode.
| `Ctrl+E` | Emoji and symbol search |
| `Ctrl+H` | One-shot Hanja search |
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. 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.
A complete Japanese reading shows its Kanji candidates with none chosen.
`Space` chooses the first and then steps on, wrapping (`Shift+Space` steps
back); `Up`/`Down` and `PageUp`/`PageDown` move without wrapping. An
unmodified `1`-`9` commits that row of the current page. `Enter` and `Tab`
commit 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.
Japanese consumes the confirming key; Korean and Vietnamese pass it on to
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.
Hiragana mode composes a complete reading before offering Kanji candidates.
Katakana mode does not perform Kanji conversion. Emoji and Hanja searches