engine: an okurigana mark does not outlive its kana

Shift on a romaji letter marks where the okurigana begins, and Backspace
shortened the reading through im.l->back without clearing the mark.
dictqjp only applies a mark that still falls inside the reading, so the
stale index lay dormant while the reading was short and fired again the
moment it grew back past it: kaKu, Backspace, then nzi offered
噛んじ 兼んじ 漢字 幹事 感じ, where kanzi typed plainly offers 漢字 first.
A Backspace edits the reading, so the split marked in it is gone.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-18 16:03:15 +09:00
parent d3d46c8cb1
commit 08d0e0fec8
2 changed files with 8 additions and 0 deletions

View File

@@ -970,6 +970,7 @@ transition(u32int ks, u32int mod, Str *com)
else if(ks == Kesc)
reset();
else{
okuriat = -1; /* the mark goes with the kana it marked */
im.l->back(&im);
if(haspre(&im))
dictqjp();

View File

@@ -1277,6 +1277,13 @@ engine_japanese_candidates(struct ct *t)
checkstr(t, "then the second", "描く", &im.kouho[1]);
checkstr(t, "then the reading's own", "", &im.kouho[2]);
}
/* Backspace edits the reading, so the split it marked is gone. */
CT_CHECK(t, keystroke(Kback, 0, &com));
CT_CHECK(t, keystroke('k', 0, &com));
CT_CHECK(t, keystroke('u', 0, &com));
if(CT_EQ_INT(t, 3, im.nkouho))
checkstr(t, "the mark did not outlive its kana", "",
&im.kouho[0]);
CT_CHECK(t, keystroke(Kesc, 0, &com));
setdict(jp->dict, "いt", "言 行");
setdict(jp->dict, "いっt", "言 行");