engine: reject stale dictionary results
This commit is contained in:
7
strans.c
7
strans.c
@@ -6,6 +6,7 @@ static int visible = 0;
|
||||
static void *activeowner;
|
||||
static int activecap;
|
||||
static Caret caret;
|
||||
static u32int dictseq;
|
||||
static void dictqmap(Im*);
|
||||
static void dictqjp(Im*);
|
||||
static void backjp(Im*);
|
||||
@@ -34,6 +35,7 @@ int nlang = nelem(langs);
|
||||
static void
|
||||
clearkouho(void)
|
||||
{
|
||||
dictseq++;
|
||||
im.nkouho = 0;
|
||||
im.sel = -1;
|
||||
}
|
||||
@@ -147,6 +149,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
|
||||
@@ -453,6 +456,7 @@ searchlookup(int lang, Str *key, Dictres *res)
|
||||
req.key = *key;
|
||||
req.pre = req.key;
|
||||
req.lang = lang;
|
||||
req.seq = 0;
|
||||
dictlookup(&req, res);
|
||||
}
|
||||
|
||||
@@ -769,6 +773,7 @@ init(void)
|
||||
memset(&caret, 0, sizeof caret);
|
||||
activeowner = nil;
|
||||
activecap = 0;
|
||||
dictseq = 0;
|
||||
visible = 0;
|
||||
}
|
||||
|
||||
@@ -833,7 +838,7 @@ dictresult(Dictres *res)
|
||||
Str pre;
|
||||
|
||||
impre(&pre);
|
||||
if(search.lang || res->lang != im.l->lang ||
|
||||
if(search.lang || res->seq != dictseq || res->lang != im.l->lang ||
|
||||
scmp(&res->key, &pre) != 0)
|
||||
return;
|
||||
setkouho(res);
|
||||
|
||||
Reference in New Issue
Block a user