test: drive Korean and Vietnamese through the engine's own transstr

ko_test and vi_test replayed keys with private copies of transstr's
loop, and test_util reimplemented the shown preedit; the engine exports
impre(Im*, Str*) and transstr() instead, so a change to composition
rules is one edit.
This commit is contained in:
2026-08-16 16:25:40 +09:00
parent 849bf1278b
commit 826da31486
7 changed files with 32 additions and 78 deletions

View File

@@ -148,13 +148,13 @@ haspre(Im *p)
}
/* The preedit as clients see it: Telex keys read back through the map. */
static void
impre(Str *s)
void
impre(Im *p, Str *s)
{
if(isjp(&im))
jpreading(im.l->map, &im.pre, &im.raw, s);
else if(!mapget(im.l->map, &im.pre, s))
*s = im.pre;
if(isjp(p))
jpreading(p->l->map, &p->pre, &p->raw, s);
else if(!mapget(p->l->map, &p->pre, s))
*s = p->pre;
}
static void
@@ -167,7 +167,7 @@ snapshot(Drawcmd *dc)
if(search.lang)
pre = search.text;
else
impre(&pre);
impre(&im, &pre);
if(!(activecap & Cclientpreedit))
dc->pre = pre;
first = pagefirst();
@@ -456,7 +456,7 @@ foldascii(Str *s)
}
/* What typing raw in language l would produce, composition included. */
static void
void
transstr(Lang *l, Str *raw, Str *out)
{
Im q;
@@ -827,7 +827,7 @@ imhandlekey(Keyreq *kr)
if(search.lang)
res.preedit = search.text;
else
impre(&res.preedit);
impre(&im, &res.preedit);
}
chansend(kr->reply, &res);
}