fix(engine): keep composing when a reading reaches Maxrunes

At the limit the key that did not fit was handed back to the client as
plain ASCII, so a long Japanese reading ended in a Latin letter, and a
pending romaji consonant was flushed as ASCII with it (…あka for か).
Commit the completed kana, keep the pending syllable, and transliterate
the key as usual; other languages commit and go on the same way.
This commit is contained in:
2026-08-16 20:25:38 +09:00
parent cdd3e38195
commit 9853d65d4c
2 changed files with 21 additions and 4 deletions

View File

@@ -751,9 +751,13 @@ transition(u32int ks, u32int mod, Str *com)
return 0;
if(im.pre.n >= Maxrunes ||
(isjp(&im) && im.pre.n + im.raw.n >= Maxrunes)){
commit(com);
reset();
return 0;
/* A full reading commits; a pending romaji syllable stays. */
if(isjp(&im))
sappend(com, &im.pre);
else
commit(com);
sclear(&im.pre);
clearkouho();
}
return dotrans(ks, com);
}