fix(engine): send clients the composed Telex text, not the keys
For Vietnamese the preedit is the map key ('as', 'oong'); only the popup
and the commit path looked it up. Clients with inline preedit therefore
showed 'as' while Enter committed 'á'. impre() now maps once for every
reader, and snapshot() no longer maps a second time.
This commit is contained in:
15
strans.c
15
strans.c
@@ -134,12 +134,13 @@ haspre(Im *p)
|
||||
return p->pre.n != 0 || (isjp(p) && p->raw.n != 0);
|
||||
}
|
||||
|
||||
/* The preedit as clients see it: Telex keys read back through the map. */
|
||||
static void
|
||||
impre(Str *s)
|
||||
{
|
||||
if(isjp(&im))
|
||||
jpreading(&im, s);
|
||||
else
|
||||
else if(!mapget(im.l->map, &im.pre, s))
|
||||
*s = im.pre;
|
||||
}
|
||||
|
||||
@@ -167,11 +168,8 @@ snapshot(Drawcmd *dc)
|
||||
pre = search.text;
|
||||
else
|
||||
impre(&pre);
|
||||
if(!(activecap & Cclientpreedit)){
|
||||
if(search.lang || isjp(&im) || im.l->map == nil ||
|
||||
!mapget(im.l->map, &pre, &dc->pre))
|
||||
dc->pre = pre;
|
||||
}
|
||||
if(!(activecap & Cclientpreedit))
|
||||
dc->pre = pre;
|
||||
first = pagefirst();
|
||||
n = im.nkouho - first;
|
||||
if(n > Maxdisp) n = Maxdisp;
|
||||
@@ -220,10 +218,7 @@ dictsend(Im *im, Str *key)
|
||||
req.key = *key;
|
||||
req.lang = im->l->lang;
|
||||
req.seq = dictseq;
|
||||
if(isjp(im))
|
||||
jpreading(im, &req.pre);
|
||||
else
|
||||
req.pre = im->pre;
|
||||
impre(&req.pre);
|
||||
/* imthread is the sole producer; discard every obsolete queued lookup. */
|
||||
while(channbrecv(dictreqc, &old) > 0)
|
||||
;
|
||||
|
||||
Reference in New Issue
Block a user