engine: Backspace and Escape share their way back to the reading

This commit is contained in:
2026-08-17 01:55:57 +09:00
parent e32cea3296
commit 268b687ee6

View File

@@ -142,10 +142,11 @@ isjp(Im *p)
}
/*
* Japanese keeps completed kana in pre and an ambiguous romaji syllable in
* raw. A mapped raw suffix is part of the reading even while it remains
* pending (notably n, which may still grow into nya). Returns whether
* the reading is complete.
* Japanese keeps completed kana, and any romaji that never became kana,
* in pre, and the romaji still being typed in raw. A mapped raw suffix
* is part of the reading even while it remains pending (notably n,
* which may still grow into nya). Returns whether the reading is
* complete.
*/
static int
jpreading(Trie *map, Str *pre, Str *raw, Str *s)
@@ -825,27 +826,20 @@ transition(u32int ks, u32int mod, Str *com)
/* Japanese confirms with the key; Korean and Telex let it on. */
return isjp(&im);
}
if(ks == Kback){
if(!haspre(&im))
return 0;
if(im.sel >= 0){
im.sel = -1; /* back from the candidate to the reading */
return 1;
}
im.l->back(&im);
if(haspre(&im))
dictqjp();
else
reset();
return 1;
}
if(ks == Kesc){
if(ks == Kback || ks == Kesc){
if(!haspre(&im))
return 0;
if(im.sel >= 0)
im.sel = -1;
else
im.sel = -1; /* back from the candidate to the reading */
else if(ks == Kesc)
reset();
else{
im.l->back(&im);
if(haspre(&im))
dictqjp();
else
reset();
}
return 1;
}
if(ks >= Kspec || chord(mod)){