[F] Fix 12-key IME
This commit is contained in:
@@ -28,14 +28,17 @@ export function fuzzyEquals(kana1: string, kana2: string): string {
|
||||
}
|
||||
|
||||
// List of characters need to be composed instead of directly typed
|
||||
export const composeList = [
|
||||
'っ', 'ゃ', 'ゅ', 'ょ', 'ぁ', 'ぃ', 'ぅ', 'ぇ', 'ぉ',
|
||||
'が', 'ぎ', 'ぐ', 'げ', 'ご',
|
||||
'ざ', 'じ', 'ず', 'ぜ', 'ぞ',
|
||||
'だ', 'ぢ', 'づ', 'で', 'ど',
|
||||
'ば', 'び', 'ぶ', 'べ', 'ぼ',
|
||||
'ぱ', 'ぴ', 'ぷ', 'ぺ', 'ぽ'
|
||||
]
|
||||
export const composeMap = new Map(Object.entries({
|
||||
'っ': 'つ', 'ゃ': 'や', 'ゅ': 'ゆ', 'ょ': 'よ', 'ぁ': 'あ',
|
||||
'ぃ': 'い', 'ぅ': 'う', 'ぇ': 'え', 'ぉ': 'お',
|
||||
|
||||
'が': 'か', 'ぎ': 'き', 'ぐ': 'く', 'げ': 'け', 'ご': 'こ',
|
||||
'ざ': 'さ', 'じ': 'し', 'ず': 'す', 'ぜ': 'せ', 'ぞ': 'そ',
|
||||
'だ': 'た', 'ぢ': 'ち', 'づ': 'つ', 'で': 'て', 'ど': 'と',
|
||||
'ば': 'は', 'び': 'ひ', 'ぶ': 'ふ', 'べ': 'へ', 'ぼ': 'ほ',
|
||||
'ぱ': 'は', 'ぴ': 'ひ', 'ぷ': 'ふ', 'ぺ': 'へ', 'ぽ': 'ほ',
|
||||
}))
|
||||
export const composeList = Array.from(composeMap.keys())
|
||||
|
||||
/**
|
||||
* Remove duplicate lyric lines based on their content.
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import { onMount } from "svelte"
|
||||
import { typingSettingsDefault } from "$lib/types.ts"
|
||||
import { isKana, isKanji, toHiragana } from "wanakana"
|
||||
import { composeList, fuzzyEquals, processLrcLine, dedupLines, isEnglish, type ProcLrcLine } from "$lib/ui/player/IMEHelper.ts"
|
||||
import { composeList, fuzzyEquals, processLrcLine, dedupLines, isEnglish, type ProcLrcLine, composeMap } from "$lib/ui/player/IMEHelper.ts"
|
||||
import "$lib/ext.ts"
|
||||
import { API } from "$lib/client.ts"
|
||||
import { goto } from '$app/navigation'
|
||||
@@ -114,7 +114,8 @@
|
||||
// Check if it matches current character
|
||||
let { cLine, cSeg, exp } = findLoc()
|
||||
let res = fuzzyEquals(char, exp)
|
||||
if (res === 'wrong' && !imeUsed && !isComposed && composeList.includes(exp)) return // Need to compose, stop here
|
||||
// Need to compose, stop here
|
||||
if (res !== 'right' && !imeUsed && !isComposed && composeList.includes(exp) && composeMap.get(exp) === char) return
|
||||
states[li][wi] = res
|
||||
|
||||
// Record stats
|
||||
|
||||
Reference in New Issue
Block a user