engine: Backspace deletes the last kana shown; Tab converts like Space
Backspace undid a keystroke: な became ん, かんじ became かんj, きゃ became ky. Like every Japanese IME it now deletes the last kana as shown — な goes, かんじ becomes かん, きゃ becomes き — while a romaji letter that never became kana still goes one at a time. Tab stepped through candidates in a search and committed in Japanese; it steps through them there too, with Space, and Shift+Tab steps back.
This commit is contained in:
20
strans.c
20
strans.c
@@ -356,13 +356,20 @@ commitim(Im *p, Str *com)
|
||||
sclear(&p->raw);
|
||||
}
|
||||
|
||||
/* Deletes the last kana as shown, not the last key: kya loses ゃ. */
|
||||
static void
|
||||
backjp(Im *p)
|
||||
{
|
||||
if(p->raw.n != 0)
|
||||
spopr(&p->raw);
|
||||
else
|
||||
Str v;
|
||||
|
||||
if(p->raw.n == 0)
|
||||
spopr(&p->pre);
|
||||
else if(mapget(p->l->map, &p->raw, &v)){
|
||||
spopr(&v);
|
||||
sappend(&p->pre, &v);
|
||||
sclear(&p->raw);
|
||||
}else
|
||||
spopr(&p->raw);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -800,9 +807,10 @@ transition(u32int ks, u32int mod, Str *com)
|
||||
reset();
|
||||
return 1;
|
||||
}
|
||||
if(ks == ' ' && isjp(&im) && haspre(&im) && !(mod & ~Mshift)){
|
||||
/* Space converts: it steps through the candidates, Katakana
|
||||
* last; a reading with none is committed. */
|
||||
if((ks == ' ' || ks == Ktab) && isjp(&im) && haspre(&im) &&
|
||||
!(mod & ~Mshift)){
|
||||
/* Space and Tab convert: they step through the candidates,
|
||||
* Katakana last; a reading with none is committed. */
|
||||
katakouho();
|
||||
if(im.nkouho != 0)
|
||||
cyclekouho(mod & Mshift ? -1 : 1);
|
||||
|
||||
Reference in New Issue
Block a user