fix: forward input at the composition limit

This commit is contained in:
2026-08-12 16:21:33 +09:00
parent 9d60c4bbb0
commit 5927f6a5e1
4 changed files with 35 additions and 1 deletions

View File

@@ -718,8 +718,10 @@ keystroke(u32int ks, u32int mod, Str *com)
if(!haspre(&im))
return 0;
commit(com);
sputr(com, ks);
reset();
if(com->n >= Maxrunes)
return 0;
sputr(com, ks);
return 1;
}
if(im.l->trans == nil)

View File

@@ -1280,3 +1280,33 @@ engine_randomized_stress(struct ct *t)
emojiend(&f);
vi->map = vimap;
}
void
engine_full_boundary_passthrough(struct ct *t)
{
Str com;
int i;
init();
im.l = getlang(LangJP);
for(i = 0; i < Maxrunes; i++)
im.pre.r[i] = L'';
im.pre.n = Maxrunes;
sclear(&com);
CT_CHECK(t, !keystroke(' ', 0, &com));
CT_EQ_INT(t, Maxrunes, com.n);
for(i = 0; i < Maxrunes; i++)
CT_EQ_UINT(t, L'', com.r[i]);
CT_EQ_INT(t, 0, im.pre.n);
CT_EQ_INT(t, 0, im.raw.n);
init();
im.l = getlang(LangJP);
for(i = 0; i < Maxrunes-1; i++)
im.pre.r[i] = L'';
im.pre.n = Maxrunes-1;
sclear(&com);
CT_CHECK(t, keystroke(' ', 0, &com));
CT_EQ_INT(t, Maxrunes, com.n);
CT_EQ_UINT(t, ' ', com.r[Maxrunes-1]);
}

View File

@@ -61,6 +61,7 @@ void engine_emoji_preedit_languages(struct ct*);
void engine_emoji_start_and_unknown(struct ct*);
void engine_emoji_dictionary_identity(struct ct*);
void engine_randomized_stress(struct ct*);
void engine_full_boundary_passthrough(struct ct*);
void dictionary_candidates(struct ct*);
void dictionary_misses_clear_result(struct ct*);
void dictionary_emoji_identity(struct ct*);

View File

@@ -110,6 +110,7 @@ static const struct ct_test tests[] = {
{ "engine/emoji-start-and-unknown", engine_emoji_start_and_unknown },
{ "engine/emoji-dictionary-identity", engine_emoji_dictionary_identity },
{ "engine/randomized-stress", engine_randomized_stress },
{ "engine/full-boundary-passthrough", engine_full_boundary_passthrough },
{ "dict/candidates", dictionary_candidates },
{ "dict/misses-clear-result", dictionary_misses_clear_result },
{ "dict/emoji-identity", dictionary_emoji_identity },