fix: retain the newest dictionary request
This commit is contained in:
13
strans.c
13
strans.c
@@ -135,7 +135,7 @@ reset(void)
|
||||
void
|
||||
dictsend(Im *im, Str *key)
|
||||
{
|
||||
Dictreq req;
|
||||
Dictreq old, req;
|
||||
|
||||
req.key = *key;
|
||||
req.lang = im->l->lang;
|
||||
@@ -143,6 +143,9 @@ dictsend(Im *im, Str *key)
|
||||
jpreading(im, &req.pre);
|
||||
else
|
||||
req.pre = im->pre;
|
||||
/* imthread is the sole producer; discard every obsolete queued lookup. */
|
||||
while(channbrecv(dictreqc, &old) > 0)
|
||||
;
|
||||
channbsend(dictreqc, &req);
|
||||
}
|
||||
|
||||
@@ -271,7 +274,6 @@ static int
|
||||
dotrans(Rune c, Str *com)
|
||||
{
|
||||
Emit e;
|
||||
Dictreq req;
|
||||
Str mapped;
|
||||
|
||||
if(isjp(&im))
|
||||
@@ -297,10 +299,7 @@ dotrans(Rune c, Str *com)
|
||||
sclear(&im.pre);
|
||||
sappend(&im.pre, &e.next);
|
||||
if(e.eat && e.dict.n > 0){
|
||||
req.key = e.dict;
|
||||
req.lang = im.l->lang;
|
||||
req.pre = im.pre;
|
||||
channbsend(dictreqc, &req);
|
||||
dictsend(&im, &e.dict);
|
||||
}
|
||||
return e.eat;
|
||||
}
|
||||
@@ -626,7 +625,7 @@ keystroke(u32int ks, u32int mod, Str *com)
|
||||
off = 0;
|
||||
if(im.sel >= Maxdisp)
|
||||
off = im.sel - Maxdisp + 1;
|
||||
if(n >= 0 && n < Maxdisp && off + n < im.nkouho){
|
||||
if(n >= 0 && n < Maxdisp && off + n < im.nkouho && mod == 0){
|
||||
sappend(com, &im.kouho[off + n]);
|
||||
reset();
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user