From 809e61f7384cf5450a4fc148af2045040f0d4d70 Mon Sep 17 00:00:00 2001 From: minjaesong Date: Sat, 13 Nov 2021 14:31:23 +0900 Subject: [PATCH] 3set shin p2: fixed a bug where double initial consonants were not typeable --- assets/keylayout/ko_kr_3set_shin_p2.ime | 13 ++++++++----- assets/keylayout/ko_kr_3set_shin_p2.notanime | 9 ++++++--- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/assets/keylayout/ko_kr_3set_shin_p2.ime b/assets/keylayout/ko_kr_3set_shin_p2.ime index f7c29d015..a93c8edb6 100644 --- a/assets/keylayout/ko_kr_3set_shin_p2.ime +++ b/assets/keylayout/ko_kr_3set_shin_p2.ime @@ -391,25 +391,28 @@ return Object.freeze({"n":"신세벌식 P2","v":"one","c":"CuriousTo\uA75Bvald", let isDeadkey = isJungseongDeadkey(headkey) let hasChoseong = isChoseong(states.buf[0]) let hasJungseong = isJungseong(states.buf[1]) - let shiftForJungseong = hasChoseong && !hasJungseong + let shiftForJungseong = hasChoseong && !hasJungseong && s2 != undefined let deadkeyAcceptable = isDeadkey && !states.hasDeadkey && shiftForJungseong if (isHangul(s)) { // auto-change alternative layer if choseong is in the buffer already // unshift when jungseong is there // Korean threesetters call this feature "Galmadeuri" Input - + let autoshifted = false // if deadkeyAcceptable? -OR- shiftForJungseong? -OR- (notdeadkey? -AND- A as in GWA) if (deadkeyAcceptable || shiftForJungseong || (!isDeadkey && states.hasDeadkey)) { -// console.log(`Shiftin--keycode=${headkey}, isDeadkey=${isDeadkey}, hasChoseong=${hasChoseong}, hasJungseong=${hasJungseong}; deadkeyAcceptable=${deadkeyAcceptable}, shiftForJungseong=${shiftForJungseong}, (!isDeadkey && states.hasDeadkey)=${(!isDeadkey && states.hasDeadkey)}`) +// console.log(`Shiftin--keycode=${headkey}, isDeadkey=${isDeadkey}, shiftForJungseong=${shiftForJungseong}, hasChoseong=${hasChoseong}, hasJungseong=${hasJungseong}; deadkeyAcceptable=${deadkeyAcceptable}, shiftForJungseong=${shiftForJungseong}, (!isDeadkey && states.hasDeadkey)=${(!isDeadkey && states.hasDeadkey)}`) s = s2 bufIndex = 1 + autoshifted = true states.hasDeadkey = deadkeyAcceptable } else { states.hasDeadkey = false } +// console.log(`accepting hangul '${s}' at buf[${bufIndex}], autoshifted=${autoshifted}, states.hasDeadkey=${states.hasDeadkey}`) + // ㄲ ㄸ ㅃ ㅆ ㅉ (only allow when the jung/jongseong is not typed) if (0 == bufIndex && !states.buf[1] && isChoseongDigraph(states.buf[0]) && states.buf[0] == s) { states.buf[0] = choseongDigraphs[s] @@ -459,11 +462,11 @@ return Object.freeze({"n":"신세벌식 P2","v":"one","c":"CuriousTo\uA75Bvald", states.buf[bufIndex] = s if (bufferEmpty) { -// console.log(`assembling: ${bufDebugStringify(states.buf)} -> 0,${bufAssemble()}`) +// console.log(`assem0: ${bufDebugStringify(states.buf)} -> 0,${bufAssemble()}`) return ["0", bufAssemble()] } else { -// console.log(`assembling: ${bufDebugStringify(states.buf)} -> 1,${bufAssemble()}`) +// console.log(`assem1: ${bufDebugStringify(states.buf)} -> 1,${bufAssemble()}`) return ["1", bufAssemble()] } } diff --git a/assets/keylayout/ko_kr_3set_shin_p2.notanime b/assets/keylayout/ko_kr_3set_shin_p2.notanime index 241e99cb5..bc6f4a08c 100644 --- a/assets/keylayout/ko_kr_3set_shin_p2.notanime +++ b/assets/keylayout/ko_kr_3set_shin_p2.notanime @@ -394,25 +394,28 @@ return Object.freeze({"n":"신세벌식 P2","v":"one","c":"CuriousTo\uA75Bvald", let isDeadkey = isJungseongDeadkey(headkey) let hasChoseong = isChoseong(states.buf[0]) let hasJungseong = isJungseong(states.buf[1]) - let shiftForJungseong = hasChoseong && !hasJungseong + let shiftForJungseong = hasChoseong && !hasJungseong && s2 != undefined let deadkeyAcceptable = isDeadkey && !states.hasDeadkey && shiftForJungseong if (isHangul(s)) { // auto-change alternative layer if choseong is in the buffer already // unshift when jungseong is there // Korean threesetters call this feature "Galmadeuri" Input - + let autoshifted = false // if deadkeyAcceptable? -OR- shiftForJungseong? -OR- (notdeadkey? -AND- A as in GWA) if (deadkeyAcceptable || shiftForJungseong || (!isDeadkey && states.hasDeadkey)) { -// console.log(`Shiftin--keycode=${headkey}, isDeadkey=${isDeadkey}, hasChoseong=${hasChoseong}, hasJungseong=${hasJungseong}; deadkeyAcceptable=${deadkeyAcceptable}, shiftForJungseong=${shiftForJungseong}, (!isDeadkey && states.hasDeadkey)=${(!isDeadkey && states.hasDeadkey)}`) +// console.log(`Shiftin--keycode=${headkey}, isDeadkey=${isDeadkey}, shiftForJungseong=${shiftForJungseong}, hasChoseong=${hasChoseong}, hasJungseong=${hasJungseong}; deadkeyAcceptable=${deadkeyAcceptable}, shiftForJungseong=${shiftForJungseong}, (!isDeadkey && states.hasDeadkey)=${(!isDeadkey && states.hasDeadkey)}`) s = s2 bufIndex = 1 + autoshifted = true states.hasDeadkey = deadkeyAcceptable } else { states.hasDeadkey = false } +// console.log(`accepting hangul '${s}' at buf[${bufIndex}], autoshifted=${autoshifted}, states.hasDeadkey=${states.hasDeadkey}`) + // ㄲ ㄸ ㅃ ㅆ ㅉ (only allow when the jung/jongseong is not typed) if (0 == bufIndex && !states.buf[1] && isChoseongDigraph(states.buf[0]) && states.buf[0] == s) { states.buf[0] = choseongDigraphs[s]