mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-19 06:54:05 +09:00
Minor improvements on automata for Korean 3set-like IMEs
This commit is contained in:
@@ -454,22 +454,24 @@ return Object.freeze({"n":"신세벌식 ’03","v":"one","c":"CuriousTo\uA75Bval
|
||||
else if (2 == bufIndex && "\u11B8" == states.buf[2] && isJongseongDigraphB(s)) {
|
||||
states.buf[2] = jongseongDigraphsB[s]
|
||||
}
|
||||
// key inputs that bufIndex collides (end compose and accept incoming char as a new char state)
|
||||
// sending out assembled syllable and accepting new hangul character
|
||||
else if (states.buf[bufIndex] !== undefined) {
|
||||
let oldstr = bufAssemble(1)
|
||||
reset()
|
||||
states.buf[bufIndex] = s
|
||||
// console.log(`sending bufout: 1,${oldstr} ${bufDebugStringify(states.buf)}`)
|
||||
return ["1", oldstr + bufAssemble()]
|
||||
return ["1", oldstr + bufAssemble(1)]
|
||||
}
|
||||
else {
|
||||
let bufferEmpty = isBufferEmpty(states.buf)
|
||||
states.buf[bufIndex] = s
|
||||
|
||||
// head of the word after the non-hangul
|
||||
if (bufferEmpty) {
|
||||
// console.log(`assem0: ${bufDebugStringify(states.buf)} -> 0,${bufAssemble()}`)
|
||||
return ["0", bufAssemble()]
|
||||
return ["0", bufAssemble(1)]
|
||||
}
|
||||
// not head of the word
|
||||
else {
|
||||
// console.log(`assem1: ${bufDebugStringify(states.buf)} -> 1,${bufAssemble()}`)
|
||||
return ["1", bufAssemble()]
|
||||
@@ -477,14 +479,16 @@ return Object.freeze({"n":"신세벌식 ’03","v":"one","c":"CuriousTo\uA75Bval
|
||||
}
|
||||
|
||||
// console.log(`assem-digraph: ${bufDebugStringify(states.buf)} -> 1,${bufAssemble()}`)
|
||||
return ["1", bufAssemble()]
|
||||
return ["1", bufAssemble(1)]
|
||||
}
|
||||
// sending out assembled syllable and accepting new non-hangul character
|
||||
else if (isBufferNotEmpty(states.buf)) {
|
||||
let oldstr = bufAssemble(1)
|
||||
reset()
|
||||
// console.log(`sending1 out: 1,${oldstr}${s}`)
|
||||
return ["1", oldstr + s]
|
||||
}
|
||||
// non-hangul
|
||||
else {
|
||||
// console.log(`sending0 out: 0,${s}`)
|
||||
return ["0", s]
|
||||
@@ -512,7 +516,7 @@ return Object.freeze({"n":"신세벌식 ’03","v":"one","c":"CuriousTo\uA75Bval
|
||||
// let newbufstr = bufDebugStringify(states.buf)
|
||||
// console.log(`popping assembly: ${oldbufstr} -> 1,${newbufstr}`)
|
||||
|
||||
return bufAssemble()
|
||||
return bufAssemble(1)
|
||||
},
|
||||
"end":()=>{
|
||||
// console.log(`end composing`)
|
||||
|
||||
Reference in New Issue
Block a user