diff --git a/strans.c b/strans.c index 4158cf8..68ed464 100644 --- a/strans.c +++ b/strans.c @@ -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); } diff --git a/tests/engine_test.c b/tests/engine_test.c index 5e36e9e..43ddcf5 100644 --- a/tests/engine_test.c +++ b/tests/engine_test.c @@ -1904,7 +1904,7 @@ engine_randomized_stress(struct ct *t) void engine_full_boundary_passthrough(struct ct *t) { - Str com; + Str com, shown; int i; init(); @@ -1929,4 +1929,17 @@ engine_full_boundary_passthrough(struct ct *t) CT_CHECK(t, keystroke(' ', 0, &com)); CT_EQ_INT(t, Maxrunes, com.n); CT_EQ_UINT(t, ' ', com.r[Maxrunes-1]); + + /* Typing on at the limit commits the kana and keeps the syllable. */ + init(); + im.l = getlang(LangJP); + for(i = 0; i < Maxrunes-1; i++) + im.pre.r[i] = L'あ'; + im.pre.n = Maxrunes-1; + im.raw = mkstr("k"); + sclear(&com); + CT_CHECK(t, keystroke('a', 0, &com)); + CT_EQ_INT(t, Maxrunes-1, com.n); + impre(&im, &shown); + checkstr(t, "syllable after the flush", "か", &shown); }