engine: keys outside a map pass on like any other; one candidate query; the caret rides on every key
Space and non-ASCII keys with a Korean or Telex syllable pending were committed as text along with the syllable, while '.', ',' and digits committed the syllable and passed on: one path for both now, through the language's own trans, which commits and passes on. Japanese Space is its own key already. dictqjp() knows which languages have candidates; its two callers no longer choose between it and clearkouho(). Every request carries its owner's caret as the frontend knows it, so a Keypress copies it whether valid or not, and the XIM frontend need not send a Keycaret to say that its spot went away.
This commit is contained in:
36
strans.c
36
strans.c
@@ -300,14 +300,15 @@ dictqokuri(Str *reading)
|
||||
}
|
||||
}
|
||||
|
||||
/* Kanji candidates for a complete reading; none is chosen yet. */
|
||||
/* Kanji candidates for a complete Japanese reading; none is chosen yet. */
|
||||
static void
|
||||
dictqjp(void)
|
||||
{
|
||||
Str reading;
|
||||
|
||||
clearkouho();
|
||||
if(!jpreading(im.l->map, &im.pre, &im.raw, &reading) || reading.n == 0)
|
||||
if(!isjp(&im) || !jpreading(im.l->map, &im.pre, &im.raw, &reading) ||
|
||||
reading.n == 0)
|
||||
return;
|
||||
im.nkouho = dictlookup(im.l, &reading, im.kouho, Maxkouho);
|
||||
dictqokuri(&reading);
|
||||
@@ -432,10 +433,7 @@ dotrans(Rune c, Str *com)
|
||||
sappend(com, &e.s);
|
||||
im.pre = e.next;
|
||||
im.raw = e.raw;
|
||||
if(e.eat && isjp(&im))
|
||||
dictqjp();
|
||||
else
|
||||
clearkouho();
|
||||
dictqjp();
|
||||
return e.eat;
|
||||
}
|
||||
|
||||
@@ -821,14 +819,10 @@ transition(u32int ks, u32int mod, Str *com)
|
||||
return 1;
|
||||
}
|
||||
im.l->back(&im);
|
||||
if(!haspre(&im)){
|
||||
reset();
|
||||
return 1;
|
||||
}
|
||||
if(isjp(&im))
|
||||
if(haspre(&im))
|
||||
dictqjp();
|
||||
else
|
||||
clearkouho();
|
||||
reset();
|
||||
return 1;
|
||||
}
|
||||
if(ks == Kesc){
|
||||
@@ -859,15 +853,6 @@ transition(u32int ks, u32int mod, Str *com)
|
||||
flush(com);
|
||||
return 1;
|
||||
}
|
||||
if(ks > 0x7f || ks == ' '){
|
||||
if(!haspre(&im))
|
||||
return 0;
|
||||
flush(com);
|
||||
if(com->n >= Maxrunes)
|
||||
return 0;
|
||||
sputr(com, ks);
|
||||
return 1;
|
||||
}
|
||||
if(im.l->trans == nil)
|
||||
return 0;
|
||||
if(im.sel >= 0)
|
||||
@@ -930,22 +915,21 @@ imhandlekey(Keyreq *kr)
|
||||
caret = kr->caret;
|
||||
break;
|
||||
case Keycap:
|
||||
res.eaten = activeowner != nil && kr->owner == activeowner;
|
||||
res.eaten = kr->owner == activeowner;
|
||||
if(res.eaten)
|
||||
activecap = kr->cap & Cclientpreedit;
|
||||
break;
|
||||
case Keypress:
|
||||
res.eaten = 0;
|
||||
if(activeowner != nil && kr->owner == activeowner)
|
||||
if(kr->owner == activeowner)
|
||||
activecap = kr->cap & Cclientpreedit;
|
||||
if(keymeaningful(kr->ks)){
|
||||
if(kr->owner != activeowner){
|
||||
reset();
|
||||
activeowner = kr->owner;
|
||||
activecap = kr->cap & Cclientpreedit;
|
||||
caret = kr->caret;
|
||||
}else if(kr->caret.valid)
|
||||
caret = kr->caret;
|
||||
}
|
||||
caret = kr->caret;
|
||||
res.eaten = transition(kr->ks, kr->mod, &res.commit);
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user