all US layout is changed into Intl. equivalents with AltGr support; left Ctrl+Alt can substitute AltGr; added Russian keyboard layout

This commit is contained in:
minjaesong
2021-11-10 11:22:26 +09:00
parent 950e6f1778
commit 73b6fd3e96
12 changed files with 419 additions and 108 deletions

View File

@@ -0,0 +1,3 @@
1. All keyboard layout must be capable of typing both the target language's own currency sign and the in-game currency sign.
2. Keyboard layout that cannot type English must be implemented using the IME. (JCUKEN is IME, but BÉPO is not)

View File

@@ -19,6 +19,8 @@ os,们
ii,为
iu,说
zxo,¤
a,日
a,曰
aa,昌

View File

@@ -22,6 +22,8 @@ if,為
bf,為
yu,說
zxo,¤
a,日
a,曰
aa,昌

View File

@@ -1,4 +1,4 @@
{"n":"US Colemak","capslock":"back","t":[[""],[undefined],
{"n":"Colemak","capslock":"back","t":[[""],[undefined],
[undefined],
["<HOME>"],
[undefined],
@@ -92,7 +92,7 @@
["<PAGE_UP>"],
["<PAGE_DOWN>"],
["<PICTSYMBOLS>"],
["<SW:>TCH_CHARSET>"],
["<SWITCH_CHARSET>"],
["<:A:>"],
["<:B:>"],
["<:C:>"],

View File

@@ -1,4 +1,4 @@
{"n":"US Colemak-DH","capslock":"back","t":[[""],[undefined],
{"n":"Colemak-DH","capslock":"back","t":[[""],[undefined],
[undefined],
["<HOME>"],
[undefined],
@@ -92,7 +92,7 @@
["<PAGE_UP>"],
["<PAGE_DOWN>"],
["<PICTSYMBOLS>"],
["<SW:>TCH_CHARSET>"],
["<SWITCH_CHARSET>"],
["<:A:>"],
["<:B:>"],
["<:C:>"],

View File

@@ -1,19 +1,19 @@
{"n":"US Qwerty","capslock":"caps","t":[[""],[undefined],
{"n":"US-Intl. Qwerty","capslock":"caps","t":[[""],[undefined],
[undefined],
["<HOME>"],
[undefined],
["<CALL>"],
["<ENDCALL>"],
["0",")"],
["1","!"],
["2","@"],
["3","#"],
["4","$"],
["5","%"],
["6","^"],
["7","&"],
["8","*"],
["9","("],
["0",")","","”"],
["1","!","¡","¹"],
["2","@","º","²"],
["3","#","ª","³"],
["4","$","¤","£"],
["5","%","€","€"],
["6","^","¼","\u0302"],
["7","&","½","½"],
["8","*","¾","¾"],
["9","(","","“"],
["*"],
["#"],
["<UP>"],
@@ -26,54 +26,54 @@
["<POWER>"],
["<CAMERA>"],
["<CLEAR>"],
["a","A"],
["a","A","á","Á"],
["b","B"],
["c","C"],
["d","D"],
["e","E"],
["c","C","¢","©"],
["d","D","ð","Ð"],
["e","E","é","É"],
["f","F"],
["g","G"],
["h","H"],
["i","I"],
["i","I","í","Í"],
["j","J"],
["k","K"],
["l","L"],
["m","M"],
["n","N"],
["o","O"],
["p","P"],
["q","Q"],
["r","R"],
["s","S"],
["t","T"],
["u","U"],
["l","L","ø","Ø"],
["m","M","µ","µ"],
["n","N","ñ","Ñ"],
["o","O","ó","Ó"],
["p","P","ö","Ö"],
["q","Q","ä","Ä"],
["r","R","®","®"],
["s","S","ß","§"],
["t","T","þ","Þ"],
["u","U","ú","Ú"],
["v","V"],
["w","W"],
["x","X"],
["y","Y"],
["z","Z"],
[",","<"],
["w","W","å","Å"],
["x","X","¤","¤"],
["y","Y","ü","Ü"],
["z","Z","æ","Æ"],
[",","<","ç","Ç"],
[".",">"],
["<ALT_L>"],
["<ALT_R>"],
["<SHIFT_L>"],
["<SHIFT_R>"],
["<TAB>"],
[" "],
[" "," ","\u00A0","\u00A0"],
["<SYM>"],
["<EXPLORER>"],
["<ENVELOPE>"],
["\n"],
["\x08"],
["`","~"],
["-","_"],
["=","+"],
["[","{"],
["]","}"],
["\\","|"],
[";",":"],
["'",'"'],
["/","?"],
["`","~","\u0300","\u0303"],
["-","_","","—"],
["=","+","×","÷"],
["[","{","«",""],
["]","}","»",""],
["\\","|","¬","¦"],
[";",":","¶","°"],
["'",'"',"\u0301","\u0308"],
["/","?","¿","¿"],
["<AT>"],
["<NUM_LOCK>"],
["<HEADSETHOOK>"],
@@ -92,7 +92,7 @@
["<PAGE_UP>"],
["<PAGE_DOWN>"],
["<PICTSYMBOLS>"],
["<SW:>TCH_CHARSET>"],
["<SWITCH_CHARSET>"],
["<:A:>"],
["<:B:>"],
["<:C:>"],

View File

@@ -65,12 +65,12 @@ let states = {"keylayouts":[[""],[undefined],
[undefined],
["\n"],
["\x08"],
["`","~"],
["¤","~"],
["-","_"],
["=","+"],
["[","{"],
["]","}"],
["\\","|"],
["\\",""],
[";",":"],
["'",'"'],
["/","?"],
@@ -261,20 +261,20 @@ let reset = () => {
states.buf = []
}
let inRange = (s,a,b) => (a <= s && s <= b)
let isHangul = (s) => (s === undefined) ? false : inRange(s.charCodeAt(0), 0x3131, 0x318E)
let isConsonant = (s) => (s === undefined) ? false : inRange(s.charCodeAt(0), 0x3131, 0x314E)
let isVowel = (s) => (s === undefined) ? false : (inRange(s.charCodeAt(0), 0x314F, 0x3163) || inRange(s.charCodeAt(0), 0x318D, 0x318E))
let isVowelSuper = (s) => (s === undefined) ? false : inRange(s.charCodeAt(0), 0x318D, 0x318E)
let isJongseongConsonant = (s) => (s === undefined) ? false : (inRange(s.charCodeAt(0), 0x3131, 0x314E) && !([0x3138, 0x3143, 0x3149].includes(s.charCodeAt(0))))
let isJungseongDigraph1 = (s) => (s === undefined) ? false : ([0x3157, 0x315C].includes(s.charCodeAt(0)))
let isJungseongDigraphO = (s) => (s === undefined) ? false : ([0x314F, 0x3150, 0x3163].includes(s.charCodeAt(0)))
let isJungseongDigraphU = (s) => (s === undefined) ? false : ([0x3153, 0x3154, 0x3163].includes(s.charCodeAt(0)))
let isJungseongDigraphEU = (s) => (s === undefined) ? false : ([0x3163].includes(s.charCodeAt(0)))
let isJungseongDigraphAA = (s) => (s === undefined) ? false : ([0x3163].includes(s.charCodeAt(0)))
let isJongseongDigraphG = (s) => (s === undefined) ? false : ([0x3145].includes(s.charCodeAt(0)))
let isJongseongDigraphN = (s) => (s === undefined) ? false : ([0x3148, 0x314E].includes(s.charCodeAt(0)))
let isJongseongDigraphR = (s) => (s === undefined) ? false : ([0x3131, 0x3141, 0x3142, 0x3145, 0x314C, 0x314D, 0x314E].includes(s.charCodeAt(0)))
let isJongseongDigraphB = (s) => (s === undefined) ? false : ([0x3145].includes(s.charCodeAt(0)))
let isHangul = (s) => s !== undefined && inRange(s.charCodeAt(0), 0x3131, 0x318E)
let isConsonant = (s) => s !== undefined && inRange(s.charCodeAt(0), 0x3131, 0x314E)
let isVowel = (s) => s !== undefined && (inRange(s.charCodeAt(0), 0x314F, 0x3163) || inRange(s.charCodeAt(0), 0x318D, 0x318E))
let isVowelSuper = (s) => s !== undefined && inRange(s.charCodeAt(0), 0x318D, 0x318E)
let isJongseongConsonant = (s) => s !== undefined && (inRange(s.charCodeAt(0), 0x3131, 0x314E) && !([0x3138, 0x3143, 0x3149].includes(s.charCodeAt(0))))
let isJungseongDigraph1 = (s) => s !== undefined && ([0x3157, 0x315C].includes(s.charCodeAt(0)))
let isJungseongDigraphO = (s) => s !== undefined && ([0x314F, 0x3150, 0x3163].includes(s.charCodeAt(0)))
let isJungseongDigraphU = (s) => s !== undefined && ([0x3153, 0x3154, 0x3163].includes(s.charCodeAt(0)))
let isJungseongDigraphEU = (s) => s !== undefined && ([0x3163].includes(s.charCodeAt(0)))
let isJungseongDigraphAA = (s) => s !== undefined && ([0x3163].includes(s.charCodeAt(0)))
let isJongseongDigraphG = (s) => s !== undefined && ([0x3145].includes(s.charCodeAt(0)))
let isJongseongDigraphN = (s) => s !== undefined && ([0x3148, 0x314E].includes(s.charCodeAt(0)))
let isJongseongDigraphR = (s) => s !== undefined && ([0x3131, 0x3141, 0x3142, 0x3145, 0x314C, 0x314D, 0x314E].includes(s.charCodeAt(0)))
let isJongseongDigraphB = (s) => s !== undefined && ([0x3145].includes(s.charCodeAt(0)))
let jungseongDigraphsO = {"\u314F":"\u3158", "\u3150":"\u3159", "\u3163":"\u315A"}
let jungseongDigraphsU = {"\u3153":"\u315D", "\u3154":"\u315E", "\u3163":"\u315F"}
let jungseongDigraphsEU = {"\u3163":"\u3162"}
@@ -283,8 +283,8 @@ let jongseongDigraphsG = {"\u3145":"\u3133"}
let jongseongDigraphsN = {"\u3148":"\u3135", "\u314E":"\u3136"}
let jongseongDigraphsR = {"\u3131":"\u313A", "\u3141":"\u313B", "\u3142":"\u313C", "\u3145":"\u313D", "\u314C":"\u313E", "\u314D":"\u313F", "\u314E":"\u3140"}
let jongseongDigraphsB = {"\u3145":"\u3144"}
let isThisCharJongseongDigraph = (s) => (s === undefined) ? false : ([0x3133, 0x3135, 0x3136, 0x313A, 0x313B, 0x313C, 0x313D, 0x313E, 0x313F, 0x3140, 0x3144].includes(s.charCodeAt(0)))
let isThisCharJungseongDigraph = (s) => (s === undefined) ? false : ([0x3158, 0x3159, 0x315A, 0x315D, 0x315E, 0x315F, 0x3162, 0x318E].includes(s.charCodeAt(0)))
let isThisCharJongseongDigraph = (s) => s !== undefined && ([0x3133, 0x3135, 0x3136, 0x313A, 0x313B, 0x313C, 0x313D, 0x313E, 0x313F, 0x3140, 0x3144].includes(s.charCodeAt(0)))
let isThisCharJungseongDigraph = (s) => s !== undefined && ([0x3158, 0x3159, 0x315A, 0x315D, 0x315E, 0x315F, 0x3162, 0x318E].includes(s.charCodeAt(0)))
let choseongTable = {"\u3131":0,"\u3132":1,"\u3134":2,"\u3137":3,"\u3138":4,"\u3139":5,"\u3141":6,"\u3142":7,"\u3143":8,"\u3145":9,"\u3146":10,"\u3147":11,"\u3148":12,"\u3149":13,"\u314A":14,"\u314B":15,"\u314C":16,"\u314D":17,"\u314E":18}
let jongseongTable = {"\u3131":0,"\u3132":1,"\u3133":2,"\u3134":3,"\u3135":4,"\u3136":5,"\u3137":6,"\u3139":7,"\u313A":8,"\u313B":9,"\u313C":10,"\u313D":11,"\u313E":12,"\u313F":13,"\u3140":14,"\u3141":15,"\u3142":16,"\u3144":17,"\u3145":18,"\u3146":19,"\u3147":20,"\u3148":21,"\u314A":22,"\u314B":23,"\u314C":24,"\u314D":25,"\u314E":26}
let detachJongseongDigraph = {

View File

@@ -65,12 +65,12 @@ let states = {"keylayouts":[[""],[undefined],
[undefined],
["\n"],
["\x08"],
["`","~"],
["¤","~"],
["-","_"],
["=","+"],
["[","{"],
["]","}"],
["\\","|"],
["\\",""],
["\u1107",":"],
["\u1110",'"'],
["\u1169","?"],
@@ -261,21 +261,21 @@ let reset = () => {
states.buf = []
}
let inRange = (s,a,b) => (a <= s && s <= b)
let isHangul = (s) => (s === undefined) ? false : inRange(s.charCodeAt(0), 0x1100, 0x11C2)
let isChoseong = (s) => (s === undefined) ? false : inRange(s.charCodeAt(0), 0x1100, 0x1112)
let isJungseong = (s) => (s === undefined) ? false : inRange(s.charCodeAt(0), 0x1161, 0x1175)
let isJongseong = (s) => (s === undefined) ? false : inRange(s.charCodeAt(0), 0x11A8, 0x11C2)
let isChoseongDigraph = (s) => (s === undefined) ? false : ([0x1100, 0x1103, 0x1107, 0x1109, 0x110C].includes(s.charCodeAt(0)))
let isThisCharChoseongDigraph = (s) => (s === undefined) ? false : ([0x1101, 0x1104, 0x1108, 0x110A, 0x110D].includes(s.charCodeAt(0)))
let isThisCharJungseongDigraph = (s) => (s === undefined) ? false : ([0x116A, 0x116B, 0x116C, 0x116F, 0x1170, 0x1171, 0x1174].includes(s.charCodeAt(0)))
let isThisCharJongseongDigraph = (s) => (s === undefined) ? false : ([0x11A9, 0x11AA, 0x11AC, 0x11AD, 0x11B0, 0x11B1, 0x11B2, 0x11B3, 0x11B4, 0x11B5, 0x11B6, 0x11B9].includes(s.charCodeAt(0))) // ㅆ is an exception!
let isJungseongDigraphO = (s) => (s === undefined) ? false : ([0x1161, 0x1162, 0x1175].includes(s.charCodeAt(0)))
let isJungseongDigraphU = (s) => (s === undefined) ? false : ([0x1165, 0x1166, 0x1175].includes(s.charCodeAt(0)))
let isJungseongDigraphEU = (s) => (s === undefined) ? false : ([0x1175].includes(s.charCodeAt(0)))
let isJongseongDigraphG = (s) => (s === undefined) ? false : ([0x11A8, 0x11BA].includes(s.charCodeAt(0)))
let isJongseongDigraphN = (s) => (s === undefined) ? false : ([0x11BD, 0x11C2].includes(s.charCodeAt(0)))
let isJongseongDigraphR = (s) => (s === undefined) ? false : ([0x11A8, 0x11B7, 0x11B8, 0x11BA, 0x11C0, 0x11C1, 0x11C2].includes(s.charCodeAt(0)))
let isJongseongDigraphB = (s) => (s === undefined) ? false : ([0x11BA].includes(s.charCodeAt(0)))
let isHangul = (s) => s !== undefined && inRange(s.charCodeAt(0), 0x1100, 0x11C2)
let isChoseong = (s) => s !== undefined && inRange(s.charCodeAt(0), 0x1100, 0x1112)
let isJungseong = (s) => s !== undefined && inRange(s.charCodeAt(0), 0x1161, 0x1175)
let isJongseong = (s) => s !== undefined && inRange(s.charCodeAt(0), 0x11A8, 0x11C2)
let isChoseongDigraph = (s) => s !== undefined && ([0x1100, 0x1103, 0x1107, 0x1109, 0x110C].includes(s.charCodeAt(0)))
let isThisCharChoseongDigraph = (s) => s !== undefined && ([0x1101, 0x1104, 0x1108, 0x110A, 0x110D].includes(s.charCodeAt(0)))
let isThisCharJungseongDigraph = (s) => s !== undefined && ([0x116A, 0x116B, 0x116C, 0x116F, 0x1170, 0x1171, 0x1174].includes(s.charCodeAt(0)))
let isThisCharJongseongDigraph = (s) => s !== undefined && ([0x11A9, 0x11AA, 0x11AC, 0x11AD, 0x11B0, 0x11B1, 0x11B2, 0x11B3, 0x11B4, 0x11B5, 0x11B6, 0x11B9].includes(s.charCodeAt(0))) // ㅆ is an exception!
let isJungseongDigraphO = (s) => s !== undefined && ([0x1161, 0x1162, 0x1175].includes(s.charCodeAt(0)))
let isJungseongDigraphU = (s) => s !== undefined && ([0x1165, 0x1166, 0x1175].includes(s.charCodeAt(0)))
let isJungseongDigraphEU = (s) => s !== undefined && ([0x1175].includes(s.charCodeAt(0)))
let isJongseongDigraphG = (s) => s !== undefined && ([0x11A8, 0x11BA].includes(s.charCodeAt(0)))
let isJongseongDigraphN = (s) => s !== undefined && ([0x11BD, 0x11C2].includes(s.charCodeAt(0)))
let isJongseongDigraphR = (s) => s !== undefined && ([0x11A8, 0x11B7, 0x11B8, 0x11BA, 0x11C0, 0x11C1, 0x11C2].includes(s.charCodeAt(0)))
let isJongseongDigraphB = (s) => s !== undefined && ([0x11BA].includes(s.charCodeAt(0)))
let choseongDigraphs = {"\u1100":"\u1101", "\u1103":"\u1104", "\u1107":"\u1108", "\u1109":"\u110A", "\u110C":"\u110D"}
let jungseongDigraphsO = {"\u1161":"\u116A", "\u1162":"\u116B", "\u1175":"\u116C"}
let jungseongDigraphsU = {"\u1165":"\u116F", "\u1166":"\u1170", "\u1175":"\u1171"}

View File

@@ -33,7 +33,7 @@ let states = {"keylayouts":[[""],[undefined],
["\u11B8","\u1162","\u1162"],
["\u11C1","\u1161","\u1161"],
["\u11AE","\u1173","\u1173"],
["\u1102","\u25A1"],
["\u1102",""],
["\u1106","\u1173","\u1173"],
["\u110B","'"],
["\u1100",'"'],
@@ -46,7 +46,7 @@ let states = {"keylayouts":[[""],[undefined],
["\u11C0","\u1165","\u1165"],
["\u11AB","\u1168","\u1168"],
["\u11BF","\u1167","\u1167"],
["\u1103","\u25CB"],
["\u1103","¤"],
["\u11BD","\u1169","\u1169"],
["\u11AF","\u1163","\u1163"],
["\u11BB","\u116D","\u116D"],
@@ -264,23 +264,23 @@ let reset = () => {
states.hasDeadkey = false
}
let inRange = (s,a,b) => (a <= s && s <= b)
let isHangul = (s) => (s === undefined) ? false : inRange(s.charCodeAt(0), 0x1100, 0x11FF)
let isChoseong = (s) => (s === undefined) ? false : inRange(s.charCodeAt(0), 0x1100, 0x1112)
let isJungseong = (s) => (s === undefined) ? false : inRange(s.charCodeAt(0), 0x1161, 0x1175)
let isJongseong = (s) => (s === undefined) ? false : inRange(s.charCodeAt(0), 0x11A8, 0x11C2)
let isJungseongSuper = (s) => (s === undefined) ? false : inRange(s.charCodeAt(0), 0x119E, 0x11A2)
let isChoseongDigraph = (s) => (s === undefined) ? false : ([0x1100, 0x1103, 0x1107, 0x1109, 0x110C].includes(s.charCodeAt(0)))
let isThisCharChoseongDigraph = (s) => (s === undefined) ? false : ([0x1101, 0x1104, 0x1108, 0x110A, 0x110D].includes(s.charCodeAt(0)))
let isThisCharJungseongDigraph = (s) => (s === undefined) ? false : ([0x116A, 0x116B, 0x116C, 0x116F, 0x1170, 0x1171, 0x1174, 0x119F, 0x11A0, 0x11A1, 0x11A2].includes(s.charCodeAt(0)))
let isThisCharJongseongDigraph = (s) => (s === undefined) ? false : ([0x11A9, 0x11AA, 0x11AC, 0x11AD, 0x11B0, 0x11B1, 0x11B2, 0x11B3, 0x11B4, 0x11B5, 0x11B6, 0x11B9].includes(s.charCodeAt(0))) // ㅆ is an exception!
let isJungseongDigraphO = (s) => (s === undefined) ? false : ([0x1161, 0x1162, 0x1175].includes(s.charCodeAt(0)))
let isJungseongDigraphU = (s) => (s === undefined) ? false : ([0x1165, 0x1166, 0x1175].includes(s.charCodeAt(0)))
let isJungseongDigraphEU = (s) => (s === undefined) ? false : ([0x1175].includes(s.charCodeAt(0)))
let isJungseongDigraphAA = (s) => (s === undefined) ? false : ([0x1165, 0x116E, 0x1175, 0x119E].includes(s.charCodeAt(0)))
let isJongseongDigraphG = (s) => (s === undefined) ? false : ([0x11A8, 0x11BA].includes(s.charCodeAt(0)))
let isJongseongDigraphN = (s) => (s === undefined) ? false : ([0x11BD, 0x11C2].includes(s.charCodeAt(0)))
let isJongseongDigraphR = (s) => (s === undefined) ? false : ([0x11A8, 0x11B7, 0x11B8, 0x11BA, 0x11C0, 0x11C1, 0x11C2].includes(s.charCodeAt(0)))
let isJongseongDigraphB = (s) => (s === undefined) ? false : ([0x11BA].includes(s.charCodeAt(0)))
let isHangul = (s) => s !== undefined && inRange(s.charCodeAt(0), 0x1100, 0x11FF)
let isChoseong = (s) => s !== undefined && inRange(s.charCodeAt(0), 0x1100, 0x1112)
let isJungseong = (s) => s !== undefined && inRange(s.charCodeAt(0), 0x1161, 0x1175)
let isJongseong = (s) => s !== undefined && inRange(s.charCodeAt(0), 0x11A8, 0x11C2)
let isJungseongSuper = (s) => s !== undefined && inRange(s.charCodeAt(0), 0x119E, 0x11A2)
let isChoseongDigraph = (s) => s !== undefined && ([0x1100, 0x1103, 0x1107, 0x1109, 0x110C].includes(s.charCodeAt(0)))
let isThisCharChoseongDigraph = (s) => s !== undefined && ([0x1101, 0x1104, 0x1108, 0x110A, 0x110D].includes(s.charCodeAt(0)))
let isThisCharJungseongDigraph = (s) => s !== undefined && ([0x116A, 0x116B, 0x116C, 0x116F, 0x1170, 0x1171, 0x1174, 0x119F, 0x11A0, 0x11A1, 0x11A2].includes(s.charCodeAt(0)))
let isThisCharJongseongDigraph = (s) => s !== undefined && ([0x11A9, 0x11AA, 0x11AC, 0x11AD, 0x11B0, 0x11B1, 0x11B2, 0x11B3, 0x11B4, 0x11B5, 0x11B6, 0x11B9].includes(s.charCodeAt(0))) // ㅆ is an exception!
let isJungseongDigraphO = (s) => s !== undefined && ([0x1161, 0x1162, 0x1175].includes(s.charCodeAt(0)))
let isJungseongDigraphU = (s) => s !== undefined && ([0x1165, 0x1166, 0x1175].includes(s.charCodeAt(0)))
let isJungseongDigraphEU = (s) => s !== undefined && ([0x1175].includes(s.charCodeAt(0)))
let isJungseongDigraphAA = (s) => s !== undefined && ([0x1165, 0x116E, 0x1175, 0x119E].includes(s.charCodeAt(0)))
let isJongseongDigraphG = (s) => s !== undefined && ([0x11A8, 0x11BA].includes(s.charCodeAt(0)))
let isJongseongDigraphN = (s) => s !== undefined && ([0x11BD, 0x11C2].includes(s.charCodeAt(0)))
let isJongseongDigraphR = (s) => s !== undefined && ([0x11A8, 0x11B7, 0x11B8, 0x11BA, 0x11C0, 0x11C1, 0x11C2].includes(s.charCodeAt(0)))
let isJongseongDigraphB = (s) => s !== undefined && ([0x11BA].includes(s.charCodeAt(0)))
let choseongDigraphs = {"\u1100":"\u1101", "\u1103":"\u1104", "\u1107":"\u1108", "\u1109":"\u110A", "\u110C":"\u110D"}
let jungseongDigraphsO = {"\u1161":"\u116A", "\u1162":"\u116B", "\u1175":"\u116C"}
let jungseongDigraphsU = {"\u1165":"\u116F", "\u1166":"\u1170", "\u1175":"\u1171"}

View File

@@ -0,0 +1,289 @@
let states = {"keylayouts":[[""],[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
["0",")"],
["1","!"],
["2",'"'],
["3","¤"],
["4",";"],
["5","%"],
["6",":"],
["7","?"],
["8","₽"],
["9","("],
["*"],
["#"],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
["ф","Ф"],
["и","И"],
["с","С"],
["в","В"],
["у","У"],
["а","А"],
["п","П"],
["р","Р"],
["ш","Ш"],
["о","О"],
["л","Л"],
["д","Д"],
["ь","Ь"],
["т","Т"],
["щ","Щ"],
["з","З"],
["й","Й"],
["к","К"],
["ы","Ы"],
["е","Е"],
["г","Г"],
["м","М"],
["ц","Ц"],
["ч","Ч"],
["н","Н"],
["я","Я"],
["б","Б"],
["ю","Ю"],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[" "],
[undefined],
[undefined],
[undefined],
["\n"],
["\x08"],
["ё","Ё"],
["-","_"],
["=","+"],
["х","Х"],
["ъ","Ъ"],
["\\","/"],
["ж","Ж"],
["э",'Э'],
[".",","],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
["0"],
["1"],
["2"],
["3"],
["4"],
["5"],
["6"],
["7"],
["8"],
["9"],
["/"],
["*"],
["-"],
["+"],
["."],
["."],
["\n"],
["="],
["("],
[")"],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined],
[undefined]
],
"code":0} // practically unused as long as there are no diacritics on the keyboard
let reset = () => {
states.code = 0
}
let inRange = (s,a,b) => (a <= s && s <= b)
let isDiacritics = (s) => s !== undefined && inRange(s.charCodeAt(0), 0x0300, 0x036F)
return Object.freeze({"n":"Русс. ЙЦУКЕН","v":"none","c":"CuriousTo\uA75Bvald",
// return: [displayed output, composed output]
"accept":(headkey,shiftin,altgrin)=>{
let layer = 1*shiftin// + 2*altgrin
states.code = 1
let s = states.keylayouts[headkey][layer]
if (isDiacritics(s)) {
return ['', '']
}
else {
reset()
return ['', s]
}
},
"backspace":()=>{
reset()
return ''
},
"end":()=>{
reset()
return ''
},
"reset":()=>{ reset() },
"composing":()=>(states.code!=0)
})

View File

@@ -56,8 +56,8 @@ object InputStrober {
stroboTime = System.nanoTime()
repeatCount += 1
val shiftin = keys.contains(Input.Keys.SHIFT_LEFT) || keys.contains(Input.Keys.SHIFT_RIGHT)
val altgrin = keys.contains(Input.Keys.ALT_RIGHT)
val shiftin = keys.containsSome(Input.Keys.SHIFT_LEFT, Input.Keys.SHIFT_RIGHT)
val altgrin = keys.contains(Input.Keys.ALT_RIGHT) || keys.containsAll(Input.Keys.ALT_LEFT, Input.Keys.CONTROL_LEFT)
val keysym0 = keysToStr(keymap, keys)
val newKeysym0 = keysToStr(keymap, keyDiff)
val keysym =
@@ -143,4 +143,19 @@ data class TerrarumKeyboardEvent(
val headkey: Int, // representative keycode
val repeatCount: Int,
val keycodes: IntArray
)
)
fun IntArray.containsAll(vararg keys: Int): Boolean {
keys.forEach {
if (!this.contains(it)) return false
}
return true
}
fun IntArray.containsSome(vararg keys: Int): Boolean {
keys.forEach {
if (this.contains(it)) return true
}
return false
}

View File

@@ -175,11 +175,11 @@ class UIItemTextLineInput(
if (keycodes.contains(App.getConfigInt("control_key_toggleime")) && repeatCount == 1) {
toggleIME()
}
else if (keycodes.contains(Input.Keys.V) && (keycodes.contains(Input.Keys.CONTROL_LEFT) || keycodes.contains(Input.Keys.CONTROL_RIGHT))) {
else if (keycodes.contains(Input.Keys.V) && keycodes.containsSome(Input.Keys.CONTROL_LEFT, Input.Keys.CONTROL_RIGHT)) {
endComposing()
paste(Clipboard.fetch().substringBefore('\n').substringBefore('\t').toCodePoints())
}
else if (keycodes.contains(Input.Keys.C) && (keycodes.contains(Input.Keys.CONTROL_LEFT) || keycodes.contains(Input.Keys.CONTROL_RIGHT))) {
else if (keycodes.contains(Input.Keys.C) && (keycodes.containsSome(Input.Keys.CONTROL_LEFT, Input.Keys.CONTROL_RIGHT))) {
endComposing()
copyToClipboard()
}
@@ -234,8 +234,8 @@ class UIItemTextLineInput(
// - literal "<"
// - keysymbol that does not start with "<" (not always has length of 1 because UTF-16)
else if (char != null && char.length > 0 && char[0].code >= 32 && (char == "<" || !char.startsWith("<"))) {
val shiftin = keycodes.contains(Input.Keys.SHIFT_LEFT) || keycodes.contains(Input.Keys.SHIFT_RIGHT)
val altgrin = keycodes.contains(Input.Keys.ALT_RIGHT)
val shiftin = keycodes.containsSome(Input.Keys.SHIFT_LEFT, Input.Keys.SHIFT_RIGHT)
val altgrin = keycodes.contains(Input.Keys.ALT_RIGHT) || keycodes.containsAll(Input.Keys.ALT_LEFT, Input.Keys.CONTROL_LEFT)
val codepoints = if (ime != null) {
val newStatus = ime.acceptChar(headkey, shiftin, altgrin, char)
@@ -256,7 +256,7 @@ class UIItemTextLineInput(
tryCursorBack()
}
}
else if (keycodes.contains(Input.Keys.ENTER) || keycodes.contains(Input.Keys.NUMPAD_ENTER)) {
else if (keycodes.containsSome(Input.Keys.ENTER, Input.Keys.NUMPAD_ENTER)) {
endComposing()
}