From 456f926c66d3d9daaf2b91247953c35f95a5f362 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Tue, 12 Mar 2024 19:47:20 +0800 Subject: [PATCH] Refine .receiveKey(). --- Sources/Tekkon/Tekkon_SyllableComposer.swift | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Sources/Tekkon/Tekkon_SyllableComposer.swift b/Sources/Tekkon/Tekkon_SyllableComposer.swift index e9f2ddd..986a00f 100644 --- a/Sources/Tekkon/Tekkon_SyllableComposer.swift +++ b/Sources/Tekkon/Tekkon_SyllableComposer.swift @@ -204,10 +204,8 @@ public extension Tekkon { receiveKey(fromPhonabet: translate(key: input)) return } - if mapArayuruPinyinIntonation.keys.contains(input) { - if let theTone = mapArayuruPinyinIntonation[input] { - intonation = Phonabet(theTone) - } + if let theTone = mapArayuruPinyinIntonation[input] { + intonation = Phonabet(theTone) } else { // 為了防止 romajiBuffer 越敲越長帶來算力負擔,這裡讓它在要溢出時自動丟掉最早輸入的音頭。 let maxCount: Int = (parser == .ofWadeGilesPinyin) ? 7 : 6