From 57f9daa5cbe66e5d98c22db39ae6390220806dfa Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Wed, 10 Aug 2022 08:57:12 +0800 Subject: [PATCH 01/21] Repo // Tekkon v1.2.9 update. --- .../Modules/ControllerModules/SyllableComposer.swift | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Source/Modules/ControllerModules/SyllableComposer.swift b/Source/Modules/ControllerModules/SyllableComposer.swift index a9b5d26e..5e8fa2df 100644 --- a/Source/Modules/ControllerModules/SyllableComposer.swift +++ b/Source/Modules/ControllerModules/SyllableComposer.swift @@ -922,7 +922,8 @@ public struct Tekkon { /// - newToneOne: 對陰平指定新的標記。預設情況下該標記為空字串。 /// - Returns: 轉換結果。 static func cnvHanyuPinyinToPhona(target: String, newToneOne: String = "") -> String { - if target.contains("_") { return target } + /// 如果當前內容有任何除了半形英數內容以外的內容的話,就直接放棄轉換。 + if target.contains("_") || !target.isNotPureAlphanumerical { return target } var result = target for key in Tekkon.mapHanyuPinyin.keys.sorted(by: { $0.count > $1.count }) { guard let value = Tekkon.mapHanyuPinyin[key] else { continue } @@ -1446,3 +1447,12 @@ public struct Tekkon { "s": "ㄙ", "t": "ㄊ", "u": "ㄡ", "v": "ㄩ", "w": "ㄨ", "x": "ㄒ", "y": "ㄧ", "z": "ㄗ", " ": " ", ] } + +/// 檢測字串是否包含半形英數內容 +extension String { + fileprivate var isNotPureAlphanumerical: Bool { + let regex = ".*[^A-Za-z0-9].*" + let testString = NSPredicate(format: "SELF MATCHES %@", regex) + return testString.evaluate(with: self) + } +} From 4b7dcdd2e46d4b52ac9240661497be876d4be149 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Wed, 10 Aug 2022 00:13:33 +0800 Subject: [PATCH 02/21] mgrLM // Add userSCPCSequencesData-related contents. --- .../LangModelRelated/mgrLangModel.swift | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Source/Modules/LangModelRelated/mgrLangModel.swift b/Source/Modules/LangModelRelated/mgrLangModel.swift index 3fc48028..d6f721f8 100644 --- a/Source/Modules/LangModelRelated/mgrLangModel.swift +++ b/Source/Modules/LangModelRelated/mgrLangModel.swift @@ -175,6 +175,15 @@ enum mgrLangModel { ) } + public static func loadUserSCPCSequencesData() { + gLangModelCHT.loadUserSCPCSequencesData( + path: mgrLangModel.userSCPCSequencesURL(InputMode.imeModeCHT).path + ) + gLangModelCHS.loadUserSCPCSequencesData( + path: mgrLangModel.userSCPCSequencesURL(InputMode.imeModeCHS).path + ) + } + public static func checkIfUserPhraseExist( userPhrase: String, mode: InputMode, @@ -256,6 +265,14 @@ enum mgrLangModel { return URL(fileURLWithPath: dataFolderPath(isDefaultFolder: false)).appendingPathComponent(fileName) } + /// 使用者逐字選字模式候選字詞順序資料路徑。 + /// - Parameter mode: 簡繁體輸入模式。 + /// - Returns: 資料路徑(URL)。 + static func userSCPCSequencesURL(_ mode: InputMode) -> URL { + let fileName = (mode == InputMode.imeModeCHT) ? "data-plain-bpmf-cht.plist" : "data-plain-bpmf-chs.plist" + return URL(fileURLWithPath: dataFolderPath(isDefaultFolder: false)).appendingPathComponent(fileName) + } + /// 使用者波浪符號選單資料路徑。 /// - Returns: 資料路徑(URL)。 static func userSymbolNodeDataURL() -> URL { @@ -311,6 +328,7 @@ enum mgrLangModel { userAssociatesDataURL(mode), populateWithTemplate: mode == .imeModeCHS ? kTemplateNameUserAssociatesCHS : kTemplateNameUserAssociatesCHT ) + || !ensureFileExists(userSCPCSequencesURL(mode)) || !ensureFileExists(userFilteredDataURL(mode), populateWithTemplate: kTemplateNameUserExclusions) || !ensureFileExists(userReplacementsDataURL(mode), populateWithTemplate: kTemplateNameUserReplacements) || !ensureFileExists(userSymbolDataURL(mode), populateWithTemplate: kTemplateNameUserSymbolPhrases) From f5d6d4e8bc936892627b53af44bb77bdb789a0c9 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Wed, 10 Aug 2022 00:14:40 +0800 Subject: [PATCH 03/21] IME // +mgrLangModel.loadUserSCPCSequencesData(). --- Source/Modules/IMEModules/IME.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/Modules/IMEModules/IME.swift b/Source/Modules/IMEModules/IME.swift index 3cc7405e..4108c016 100644 --- a/Source/Modules/IMEModules/IME.swift +++ b/Source/Modules/IMEModules/IME.swift @@ -79,6 +79,7 @@ public enum IME { // 所以這裡不需要特別處理。 mgrLangModel.loadUserAssociatesData() mgrLangModel.loadUserPhraseReplacement() + mgrLangModel.loadUserSCPCSequencesData() mgrLangModel.loadUserPhrasesData() if !userOnly { // mgrLangModel.loadDataModels() From 2474d8ac28d503183658fa49131933ba145a8edf Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Wed, 10 Aug 2022 00:06:27 +0800 Subject: [PATCH 04/21] Repo // Deploy LMPlainBopomofo. --- .../LangModelRelated/LMInstantiator.swift | 16 ++++ .../SubLMs/lmPlainBopomofo.swift | 83 +++++++++++++++++++ vChewing.xcodeproj/project.pbxproj | 4 + 3 files changed, 103 insertions(+) create mode 100644 Source/Modules/LangModelRelated/SubLMs/lmPlainBopomofo.swift diff --git a/Source/Modules/LangModelRelated/LMInstantiator.swift b/Source/Modules/LangModelRelated/LMInstantiator.swift index e0c3c681..ad8f742e 100644 --- a/Source/Modules/LangModelRelated/LMInstantiator.swift +++ b/Source/Modules/LangModelRelated/LMInstantiator.swift @@ -76,6 +76,7 @@ extension vChewing { ) var lmReplacements = LMReplacments() var lmAssociates = LMAssociates() + var lmPlainBopomofo = LMPlainBopomofo() // MARK: - 工具函式 @@ -166,6 +167,16 @@ extension vChewing { } } + public func loadUserSCPCSequencesData(path: String) { + if FileManager.default.isReadableFile(atPath: path) { + lmPlainBopomofo.close() + lmPlainBopomofo.open(path) + IME.prtDebugIntel("lmPlainBopomofo: \(lmPlainBopomofo.count) entries of data loaded from: \(path)") + } else { + IME.prtDebugIntel("lmPlainBopomofo: File access failure: \(path)") + } + } + // MARK: - 核心函式(對外) /// 威注音輸入法目前尚未具備對雙元圖的處理能力,故停用該函式。 @@ -181,6 +192,11 @@ extension vChewing { /// 準備不同的語言模組容器,開始逐漸往容器陣列內塞入資料。 var rawAllUnigrams: [Megrez.Unigram] = [] + // 如果有檢測到使用者自訂逐字選字語料庫內的相關資料的話,在這裡先插入。 + if mgrPrefs.useSCPCTypingMode { + rawAllUnigrams += lmPlainBopomofo.valuesFor(key: key).map { Megrez.Unigram.init(value: $0, score: 0) } + } + // 用 reversed 指令讓使用者語彙檔案內的詞條優先順序隨著行數增加而逐漸增高。 // 這樣一來就可以在就地新增語彙時徹底複寫優先權。 // 將兩句差分也是為了讓 rawUserUnigrams 的類型不受可能的影響。 diff --git a/Source/Modules/LangModelRelated/SubLMs/lmPlainBopomofo.swift b/Source/Modules/LangModelRelated/SubLMs/lmPlainBopomofo.swift new file mode 100644 index 00000000..356bcce3 --- /dev/null +++ b/Source/Modules/LangModelRelated/SubLMs/lmPlainBopomofo.swift @@ -0,0 +1,83 @@ +// Copyright (c) 2021 and onwards The vChewing Project (MIT-NTL License). +// StringView Ranges extension by (c) 2022 and onwards Isaac Xen (MIT License). +// ==================== +// This code is released under the MIT license (SPDX-License-Identifier: MIT) +// ... with NTL restriction stating that: +// No trademark license is granted to use the trade names, trademarks, service +// marks, or product names of Contributor, except as required to fulfill notice +// requirements defined in MIT License. + +import Foundation + +extension vChewing { + @frozen public struct LMPlainBopomofo { + var rangeMap: [String: String] = [:] + + public var count: Int { + rangeMap.count + } + + public init() { + rangeMap = [:] + } + + public func isLoaded() -> Bool { + !rangeMap.isEmpty + } + + @discardableResult public mutating func open(_ path: String) -> Bool { + if isLoaded() { + return false + } + + do { + let rawData = try Data(contentsOf: URL(fileURLWithPath: path)) + let rawPlist: [String: String] = + try PropertyListSerialization.propertyList(from: rawData, format: nil) as? [String: String] ?? .init() + rangeMap = rawPlist + } catch { + IME.prtDebugIntel("\(error)") + IME.prtDebugIntel("↑ Exception happened when reading data at: \(path).") + return false + } + + return true + } + + public mutating func close() { + if isLoaded() { + rangeMap.removeAll() + } + } + + public func dump() { + // We remove this function in order to reduce out maintenance workload. + // This function will be implemented only if further hard-necessity comes. + } + + public func valuesFor(key: String) -> [String] { + var pairs: [String] = [] + if let arrRangeRecords: String = rangeMap[key] { + pairs.append(contentsOf: arrRangeRecords.map({ String($0) })) + } + var set = Set() + return pairs.filter { set.insert($0).inserted } + } + + public func hasValuesFor(key: String) -> Bool { rangeMap.keys.contains(key) } + } +} + +// MARK: - StringView Ranges Extension (by Isaac Xen) + +extension String { + fileprivate func ranges(splitBy separator: Element) -> [Range] { + var startIndex = startIndex + return split(separator: separator).reduce(into: []) { ranges, substring in + _ = range(of: substring, range: startIndex.. Date: Wed, 10 Aug 2022 09:00:07 +0800 Subject: [PATCH 05/21] LMs // Ensuring Hanyu-Pinyin keys are read in lowercase. --- Source/Modules/LangModelRelated/SubLMs/lmAssociates.swift | 2 +- Source/Modules/LangModelRelated/SubLMs/lmCoreEX.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Modules/LangModelRelated/SubLMs/lmAssociates.swift b/Source/Modules/LangModelRelated/SubLMs/lmAssociates.swift index be170656..8dfc1ce6 100644 --- a/Source/Modules/LangModelRelated/SubLMs/lmAssociates.swift +++ b/Source/Modules/LangModelRelated/SubLMs/lmAssociates.swift @@ -32,7 +32,7 @@ extension vChewing { } let arrTarget = target.dropLast().dropFirst().split(separator: ",") guard arrTarget.count == 2 else { return target } - return "(\(Tekkon.cnvHanyuPinyinToPhona(target: String(arrTarget[0]))),\(arrTarget[1]))" + return "(\(Tekkon.cnvHanyuPinyinToPhona(target: String(arrTarget[0]).lowercased())),\(arrTarget[1]))" } @discardableResult public mutating func open(_ path: String) -> Bool { diff --git a/Source/Modules/LangModelRelated/SubLMs/lmCoreEX.swift b/Source/Modules/LangModelRelated/SubLMs/lmCoreEX.swift index 5879eb95..12fe3627 100644 --- a/Source/Modules/LangModelRelated/SubLMs/lmCoreEX.swift +++ b/Source/Modules/LangModelRelated/SubLMs/lmCoreEX.swift @@ -77,7 +77,7 @@ extension vChewing { if !neta[0].isEmpty, !neta[1].isEmpty { let theKey = shouldReverse ? String(neta[1]) : String(neta[0]) let theValue = $0 - rangeMap[Tekkon.cnvHanyuPinyinToPhona(target: theKey), default: []].append(theValue) + rangeMap[Tekkon.cnvHanyuPinyinToPhona(target: theKey.lowercased()), default: []].append(theValue) } } } From 6b23432eda23b185d6b921d5a12b5d3a8ffa7cdd Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Wed, 10 Aug 2022 09:06:23 +0800 Subject: [PATCH 06/21] Repo // Lazy-load certain user-space language models. --- Source/Modules/IMEModules/IME.swift | 12 +++++-- Source/Modules/IMEModules/mgrPrefs.swift | 40 +++++++++++++++++------- 2 files changed, 38 insertions(+), 14 deletions(-) diff --git a/Source/Modules/IMEModules/IME.swift b/Source/Modules/IMEModules/IME.swift index 4108c016..24e52104 100644 --- a/Source/Modules/IMEModules/IME.swift +++ b/Source/Modules/IMEModules/IME.swift @@ -77,9 +77,15 @@ public enum IME { // mgrLangModel 的 loadUserPhrases 等函式在自動讀取 dataFolderPath 時, // 如果發現自訂目錄不可用,則會自動抹去自訂目錄設定、改採預設目錄。 // 所以這裡不需要特別處理。 - mgrLangModel.loadUserAssociatesData() - mgrLangModel.loadUserPhraseReplacement() - mgrLangModel.loadUserSCPCSequencesData() + if mgrPrefs.associatedPhrasesEnabled { + mgrLangModel.loadUserAssociatesData() + } + if mgrPrefs.phraseReplacementEnabled { + mgrLangModel.loadUserPhraseReplacement() + } + if mgrPrefs.useSCPCTypingMode { + mgrLangModel.loadUserSCPCSequencesData() + } mgrLangModel.loadUserPhrasesData() if !userOnly { // mgrLangModel.loadDataModels() diff --git a/Source/Modules/IMEModules/mgrPrefs.swift b/Source/Modules/IMEModules/mgrPrefs.swift index 4b1e4232..541e5ff2 100644 --- a/Source/Modules/IMEModules/mgrPrefs.swift +++ b/Source/Modules/IMEModules/mgrPrefs.swift @@ -388,15 +388,6 @@ public enum mgrPrefs { mgrPrefs.allowBoostingSingleKanjiAsUserPhrase ? 1 : 2 } - @UserDefault(key: UserDef.kUseSCPCTypingMode.rawValue, defaultValue: false) - static var useSCPCTypingMode: Bool - - static func toggleSCPCTypingModeEnabled() -> Bool { - useSCPCTypingMode = !useSCPCTypingMode - UserDefaults.standard.set(useSCPCTypingMode, forKey: UserDef.kUseSCPCTypingMode.rawValue) - return useSCPCTypingMode - } - @UserDefault(key: UserDef.kMaxCandidateLength.rawValue, defaultValue: 10) static var maxCandidateLength: Int @@ -564,8 +555,29 @@ public enum mgrPrefs { } } + @UserDefault(key: UserDef.kUseSCPCTypingMode.rawValue, defaultValue: false) + static var useSCPCTypingMode: Bool { + willSet { + DispatchQueue.main.asyncAfter(deadline: DispatchTime.now()) { + mgrLangModel.loadUserSCPCSequencesData() + } + } + } + + static func toggleSCPCTypingModeEnabled() -> Bool { + useSCPCTypingMode = !useSCPCTypingMode + UserDefaults.standard.set(useSCPCTypingMode, forKey: UserDef.kUseSCPCTypingMode.rawValue) + return useSCPCTypingMode + } + @UserDefault(key: UserDef.kPhraseReplacementEnabled.rawValue, defaultValue: false) - static var phraseReplacementEnabled: Bool + static var phraseReplacementEnabled: Bool { + willSet { + DispatchQueue.main.asyncAfter(deadline: DispatchTime.now()) { + mgrLangModel.loadUserPhraseReplacement() + } + } + } static func togglePhraseReplacementEnabled() -> Bool { phraseReplacementEnabled = !phraseReplacementEnabled @@ -575,7 +587,13 @@ public enum mgrPrefs { } @UserDefault(key: UserDef.kAssociatedPhrasesEnabled.rawValue, defaultValue: false) - static var associatedPhrasesEnabled: Bool + static var associatedPhrasesEnabled: Bool { + willSet { + DispatchQueue.main.asyncAfter(deadline: DispatchTime.now()) { + mgrLangModel.loadUserAssociatesData() + } + } + } static func toggleAssociatedPhrasesEnabled() -> Bool { associatedPhrasesEnabled = !associatedPhrasesEnabled From b6f89399288dd0f4167f25fa794daf5546055fa7 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Wed, 10 Aug 2022 11:10:22 +0800 Subject: [PATCH 07/21] KeyHandler // Trim useless comments. --- Source/Modules/ControllerModules/KeyHandler_HandleInput.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/Modules/ControllerModules/KeyHandler_HandleInput.swift b/Source/Modules/ControllerModules/KeyHandler_HandleInput.swift index d362d9c9..28a41c64 100644 --- a/Source/Modules/ControllerModules/KeyHandler_HandleInput.swift +++ b/Source/Modules/ControllerModules/KeyHandler_HandleInput.swift @@ -372,7 +372,6 @@ extension KeyHandler { // MARK: 摁住 Shift+字母鍵 的處理 (Shift+Letter Processing) - // 這裡不使用小麥注音 2.2 版的組字區處理方式,而是直接由詞庫負責。 if input.isUpperCaseASCIILetterKey, !input.isCommandHold, !input.isControlHold { if input.isShiftHold { // 這裡先不要判斷 isOptionHold。 switch mgrPrefs.upperCaseLetterKeyBehavior { From a3eae2a77f31f218b6845dad3efca1f3b4ce4258 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Wed, 10 Aug 2022 11:12:44 +0800 Subject: [PATCH 08/21] ctlIME // Note: alphanumerical mode toggle only works >= macOS 10.15. --- .../ctlInputMethod_Core.swift | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/Source/Modules/ControllerModules/ctlInputMethod_Core.swift b/Source/Modules/ControllerModules/ctlInputMethod_Core.swift index e9d60314..4cfd244e 100644 --- a/Source/Modules/ControllerModules/ctlInputMethod_Core.swift +++ b/Source/Modules/ControllerModules/ctlInputMethod_Core.swift @@ -187,20 +187,22 @@ class ctlInputMethod: IMKInputController { @objc(handleEvent:client:) override func handle(_ event: NSEvent!, client sender: Any!) -> Bool { _ = sender // 防止格式整理工具毀掉與此對應的參數。 - // 用 Shift 開關半形英數模式。 - if ShiftKeyUpChecker.check(event) { - if !rencentKeyHandledByKeyHandler { - NotifierController.notify( - message: String( - format: "%@%@%@", NSLocalizedString("Alphanumerical Mode", comment: ""), "\n", - toggleASCIIMode() + // 用 Shift 開關半形英數模式,僅對 macOS 10.15 及之後的 macOS 有效。 + if #available(macOS 10.15, *) { + if ShiftKeyUpChecker.check(event) { + if !rencentKeyHandledByKeyHandler { + NotifierController.notify( + message: String( + format: "%@%@%@", NSLocalizedString("Alphanumerical Mode", comment: ""), "\n", + toggleASCIIMode() ? NSLocalizedString("NotificationSwitchON", comment: "") : NSLocalizedString("NotificationSwitchOFF", comment: "") + ) ) - ) + } + rencentKeyHandledByKeyHandler = false + return false } - rencentKeyHandledByKeyHandler = false - return false } /// 這裡仍舊需要判斷 flags。之前使輸入法狀態卡住無法敲漢字的問題已在 KeyHandler 內修復。 From 6476feca8c93d95e5ad5f5f4848359814ed2362b Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Wed, 10 Aug 2022 13:05:07 +0800 Subject: [PATCH 09/21] PrefUI // Fix a nomenclature mistake. --- Source/Resources/Base.lproj/Localizable.strings | 2 +- Source/Resources/en.lproj/Localizable.strings | 2 +- Source/Resources/ja.lproj/Localizable.strings | 2 +- Source/Resources/zh-Hans.lproj/Localizable.strings | 2 +- Source/Resources/zh-Hant.lproj/Localizable.strings | 2 +- Source/UI/PrefUI/suiPrefPaneKeyboard.swift | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/Resources/Base.lproj/Localizable.strings b/Source/Resources/Base.lproj/Localizable.strings index 69440ed2..37153273 100644 --- a/Source/Resources/Base.lproj/Localizable.strings +++ b/Source/Resources/Base.lproj/Localizable.strings @@ -150,7 +150,7 @@ "Keyboard" = "Keyboard"; "Misc Settings:" = "Misc Settings:"; "MiTAC" = "MiTAC"; -"Non-QWERTY alphanumeral keyboard layouts are for Hanyu Pinyin parser only." = "Non-QWERTY alphanumeral keyboard layouts are for Hanyu Pinyin parser only."; +"Non-QWERTY alphanumerical keyboard layouts are for Hanyu Pinyin parser only." = "Non-QWERTY alphanumerical keyboard layouts are for Hanyu Pinyin parser only."; "Output Hanyu-Pinyin in lieu of Zhuyin when Ctrl(+Alt)+CMD+Enter" = "Output Hanyu-Pinyin in lieu of Zhuyin when Ctrl(+Alt)+CMD+Enter"; "Output Settings:" = "Output Settings:"; "Phonetic Parser:" = "Phonetic Parser:"; diff --git a/Source/Resources/en.lproj/Localizable.strings b/Source/Resources/en.lproj/Localizable.strings index 69440ed2..37153273 100644 --- a/Source/Resources/en.lproj/Localizable.strings +++ b/Source/Resources/en.lproj/Localizable.strings @@ -150,7 +150,7 @@ "Keyboard" = "Keyboard"; "Misc Settings:" = "Misc Settings:"; "MiTAC" = "MiTAC"; -"Non-QWERTY alphanumeral keyboard layouts are for Hanyu Pinyin parser only." = "Non-QWERTY alphanumeral keyboard layouts are for Hanyu Pinyin parser only."; +"Non-QWERTY alphanumerical keyboard layouts are for Hanyu Pinyin parser only." = "Non-QWERTY alphanumerical keyboard layouts are for Hanyu Pinyin parser only."; "Output Hanyu-Pinyin in lieu of Zhuyin when Ctrl(+Alt)+CMD+Enter" = "Output Hanyu-Pinyin in lieu of Zhuyin when Ctrl(+Alt)+CMD+Enter"; "Output Settings:" = "Output Settings:"; "Phonetic Parser:" = "Phonetic Parser:"; diff --git a/Source/Resources/ja.lproj/Localizable.strings b/Source/Resources/ja.lproj/Localizable.strings index 65626401..2bc3c170 100644 --- a/Source/Resources/ja.lproj/Localizable.strings +++ b/Source/Resources/ja.lproj/Localizable.strings @@ -150,7 +150,7 @@ "Keyboard" = "配列設定"; "Misc Settings:" = "他の設定:"; "MiTAC" = "神通配列"; -"Non-QWERTY alphanumeral keyboard layouts are for Hanyu Pinyin parser only." = "QWERTY 以外の英数キーボードは漢語弁音以外の配列に不適用。"; +"Non-QWERTY alphanumerical keyboard layouts are for Hanyu Pinyin parser only." = "QWERTY 以外の英数キーボードは漢語弁音以外の配列に不適用。"; "Output Hanyu-Pinyin in lieu of Zhuyin when Ctrl(+Alt)+CMD+Enter" = "Ctrl(+Alt)+CMD+Enter で出すのを漢語弁音と変換"; "Output Settings:" = "出力設定:"; "Phonetic Parser:" = "注音配列:"; diff --git a/Source/Resources/zh-Hans.lproj/Localizable.strings b/Source/Resources/zh-Hans.lproj/Localizable.strings index 14b6b4c8..20a43804 100644 --- a/Source/Resources/zh-Hans.lproj/Localizable.strings +++ b/Source/Resources/zh-Hans.lproj/Localizable.strings @@ -151,7 +151,7 @@ "Keyboard" = "键盘"; "Misc Settings:" = "杂项:"; "MiTAC" = "神通排列"; -"Non-QWERTY alphanumeral keyboard layouts are for Hanyu Pinyin parser only." = "QWERTY 以外的英数布局是为了汉语拼音排列使用者而准备的。"; +"Non-QWERTY alphanumerical keyboard layouts are for Hanyu Pinyin parser only." = "QWERTY 以外的英数布局是为了汉语拼音排列使用者而准备的。"; "Output Hanyu-Pinyin in lieu of Zhuyin when Ctrl(+Alt)+CMD+Enter" = "Ctrl(+Alt)+CMD+Enter 输出汉语拼音而非注音"; "Output Settings:" = "输出设定:"; "Phonetic Parser:" = "注音排列:"; diff --git a/Source/Resources/zh-Hant.lproj/Localizable.strings b/Source/Resources/zh-Hant.lproj/Localizable.strings index 17cc4a4f..5a0f9e68 100644 --- a/Source/Resources/zh-Hant.lproj/Localizable.strings +++ b/Source/Resources/zh-Hant.lproj/Localizable.strings @@ -150,7 +150,7 @@ "Keyboard" = "鍵盤"; "Misc Settings:" = "雜項:"; "MiTAC" = "神通排列"; -"Non-QWERTY alphanumeral keyboard layouts are for Hanyu Pinyin parser only." = "QWERTY 以外的英數佈局是為了漢語拼音排列使用者而準備的。"; +"Non-QWERTY alphanumerical keyboard layouts are for Hanyu Pinyin parser only." = "QWERTY 以外的英數佈局是為了漢語拼音排列使用者而準備的。"; "Output Hanyu-Pinyin in lieu of Zhuyin when Ctrl(+Alt)+CMD+Enter" = "Ctrl(+Alt)+CMD+Enter 輸出漢語拼音而非注音"; "Output Settings:" = "輸出設定:"; "Phonetic Parser:" = "注音排列:"; diff --git a/Source/UI/PrefUI/suiPrefPaneKeyboard.swift b/Source/UI/PrefUI/suiPrefPaneKeyboard.swift index 3cae715d..d3b6e4e9 100644 --- a/Source/UI/PrefUI/suiPrefPaneKeyboard.swift +++ b/Source/UI/PrefUI/suiPrefPaneKeyboard.swift @@ -181,7 +181,7 @@ struct suiPrefPaneKeyboard: View { VStack(alignment: .leading, spacing: 10) { Text( LocalizedStringKey( - "Non-QWERTY alphanumeral keyboard layouts are for Hanyu Pinyin parser only." + "Non-QWERTY alphanumerical keyboard layouts are for Hanyu Pinyin parser only." ) ) .preferenceDescription() From 16becb414749d2b2b105dd55fb02828d487d3dcf Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Wed, 10 Aug 2022 14:34:17 +0800 Subject: [PATCH 10/21] PrefUI // Move "Selection Keys" setup to Keyboard page. --- Source/UI/PrefUI/suiPrefPaneExperience.swift | 32 +------------------- Source/UI/PrefUI/suiPrefPaneKeyboard.swift | 31 +++++++++++++++++++ 2 files changed, 32 insertions(+), 31 deletions(-) diff --git a/Source/UI/PrefUI/suiPrefPaneExperience.swift b/Source/UI/PrefUI/suiPrefPaneExperience.swift index a95c7b57..1c734b10 100644 --- a/Source/UI/PrefUI/suiPrefPaneExperience.swift +++ b/Source/UI/PrefUI/suiPrefPaneExperience.swift @@ -11,9 +11,7 @@ import SwiftUI @available(macOS 11.0, *) struct suiPrefPaneExperience: View { - @State private var selSelectionKeysList = mgrPrefs.suggestedCandidateKeys - @State private var selSelectionKeys = - (UserDefaults.standard.string(forKey: UserDef.kCandidateKeys.rawValue) ?? mgrPrefs.defaultCandidateKeys) as String + @State private var selCursorPosition = UserDefaults.standard.bool( forKey: UserDef.kUseRearCursorMode.rawValue) ? 1 : 0 @@ -54,34 +52,6 @@ struct suiPrefPaneExperience: View { var body: some View { Preferences.Container(contentWidth: contentWidth) { - Preferences.Section(label: { Text(LocalizedStringKey("Selection Keys:")) }) { - ComboBox(items: mgrPrefs.suggestedCandidateKeys, text: $selSelectionKeys).frame(width: 180).onChange( - of: selSelectionKeys - ) { value in - let keys: String = value.trimmingCharacters(in: .whitespacesAndNewlines).deduplicate - do { - try mgrPrefs.validate(candidateKeys: keys) - mgrPrefs.candidateKeys = keys - selSelectionKeys = mgrPrefs.candidateKeys - } catch mgrPrefs.CandidateKeyError.empty { - selSelectionKeys = mgrPrefs.candidateKeys - } catch { - if let window = ctlPrefUI.shared.controller.window { - let alert = NSAlert(error: error) - alert.beginSheetModal(for: window) { _ in - selSelectionKeys = mgrPrefs.candidateKeys - } - clsSFX.beep() - } - } - } - Text( - LocalizedStringKey( - "Choose or hit Enter to confim your prefered keys for selecting candidates." - ) - ) - .preferenceDescription() - } Preferences.Section(label: { Text(LocalizedStringKey("Cursor Selection:")) }) { Picker("", selection: $selCursorPosition) { Text(LocalizedStringKey("in front of the phrase (like macOS built-in Zhuyin IME)")).tag(0) diff --git a/Source/UI/PrefUI/suiPrefPaneKeyboard.swift b/Source/UI/PrefUI/suiPrefPaneKeyboard.swift index d3b6e4e9..190a71a7 100644 --- a/Source/UI/PrefUI/suiPrefPaneKeyboard.swift +++ b/Source/UI/PrefUI/suiPrefPaneKeyboard.swift @@ -10,6 +10,9 @@ import SwiftUI @available(macOS 11.0, *) struct suiPrefPaneKeyboard: View { + @State private var selSelectionKeysList = mgrPrefs.suggestedCandidateKeys + @State private var selSelectionKeys = + UserDefaults.standard.string(forKey: UserDef.kCandidateKeys.rawValue) ?? mgrPrefs.defaultCandidateKeys @State private var selMandarinParser = UserDefaults.standard.integer(forKey: UserDef.kMandarinParser.rawValue) @State private var selBasicKeyboardLayout: String = UserDefaults.standard.string(forKey: UserDef.kBasicKeyboardLayout.rawValue) ?? mgrPrefs.basicKeyboardLayout @@ -40,6 +43,34 @@ struct suiPrefPaneKeyboard: View { var body: some View { Preferences.Container(contentWidth: contentWidth) { + Preferences.Section(label: { Text(LocalizedStringKey("Selection Keys:")) }) { + ComboBox(items: mgrPrefs.suggestedCandidateKeys, text: $selSelectionKeys).frame(width: 180).onChange( + of: selSelectionKeys + ) { value in + let keys: String = value.trimmingCharacters(in: .whitespacesAndNewlines).deduplicate + do { + try mgrPrefs.validate(candidateKeys: keys) + mgrPrefs.candidateKeys = keys + selSelectionKeys = mgrPrefs.candidateKeys + } catch mgrPrefs.CandidateKeyError.empty { + selSelectionKeys = mgrPrefs.candidateKeys + } catch { + if let window = ctlPrefUI.shared.controller.window { + let alert = NSAlert(error: error) + alert.beginSheetModal(for: window) { _ in + selSelectionKeys = mgrPrefs.candidateKeys + } + clsSFX.beep() + } + } + } + Text( + LocalizedStringKey( + "Choose or hit Enter to confim your prefered keys for selecting candidates." + ) + ) + .preferenceDescription() + } Preferences.Section(label: { Text(LocalizedStringKey("Phonetic Parser:")) }) { HStack { Picker("", selection: $selMandarinParser) { From c6c18b919686932e671fc37e1895c71e66e1fde8 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Wed, 10 Aug 2022 15:15:47 +0800 Subject: [PATCH 11/21] PrefWindow // Unify toolbar icons, conforming what PrefUI uses. --- .../icon_32x32.png | Bin 0 -> 572 bytes .../icon_32x32@2x.png | Bin 0 -> 879 bytes .../icon_32x32.png | Bin 0 -> 749 bytes .../icon_32x32@2x.png | Bin 0 -> 1176 bytes .../PrefToolbar-General.iconset/icon_32x32.png | Bin 0 -> 1164 bytes .../icon_32x32@2x.png | Bin 0 -> 2022 bytes .../PrefToolbar-Keyboard.iconset/icon_32x32.png | Bin 0 -> 942 bytes .../icon_32x32@2x.png | Bin 0 -> 1383 bytes Source/WindowControllers/ctlPrefWindow.swift | 8 ++++---- 9 files changed, 4 insertions(+), 4 deletions(-) create mode 100644 Source/Resources/Images/Images.xcassets/PrefToolbar-Dictionary.iconset/icon_32x32.png create mode 100644 Source/Resources/Images/Images.xcassets/PrefToolbar-Dictionary.iconset/icon_32x32@2x.png create mode 100644 Source/Resources/Images/Images.xcassets/PrefToolbar-Experiences.iconset/icon_32x32.png create mode 100644 Source/Resources/Images/Images.xcassets/PrefToolbar-Experiences.iconset/icon_32x32@2x.png create mode 100644 Source/Resources/Images/Images.xcassets/PrefToolbar-General.iconset/icon_32x32.png create mode 100644 Source/Resources/Images/Images.xcassets/PrefToolbar-General.iconset/icon_32x32@2x.png create mode 100644 Source/Resources/Images/Images.xcassets/PrefToolbar-Keyboard.iconset/icon_32x32.png create mode 100644 Source/Resources/Images/Images.xcassets/PrefToolbar-Keyboard.iconset/icon_32x32@2x.png diff --git a/Source/Resources/Images/Images.xcassets/PrefToolbar-Dictionary.iconset/icon_32x32.png b/Source/Resources/Images/Images.xcassets/PrefToolbar-Dictionary.iconset/icon_32x32.png new file mode 100644 index 0000000000000000000000000000000000000000..b7cb8877a5d534aa7a5c7d7b0c381e1ee31d1b19 GIT binary patch literal 572 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyEa{HEjtmSN`?>!lvI6;x#X;^) z4C~IxyaaNN1^9%xx)=EL^z=-bGNrMxap}^feSLkCCr@r|Z3T+-_V)Jo_jh!3Oq@7z z!h{L`|NpP9u3o%&F;J?#y}i4;d;a|Sot>R+ZEfY{68B?cD z1sbwx(h-{H4zG#)0GI>%Z5(n!A3FFwyf6VKx^m+!Lte68AJYZ{tVq&c|QYUHSPc_?M=J zTJcT2eW~w?mjVqt?&;zfVsZNDzoboFyt=akR{0HARMq5uE@ literal 0 HcmV?d00001 diff --git a/Source/Resources/Images/Images.xcassets/PrefToolbar-Dictionary.iconset/icon_32x32@2x.png b/Source/Resources/Images/Images.xcassets/PrefToolbar-Dictionary.iconset/icon_32x32@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..edee48a6f3507cdc50735d8e3ad7d74def8a9fbd GIT binary patch literal 879 zcmX9*4KR~&7=M{en;LGVIwdZlautbnUCrWHYDw;rE{Z5QBE&wj51+4Ln~m7!R+;U{ z9LvoVit3^d$|)|TRpes6t4qmxx}LlD`TzdU^Lu{J^FDtxgci68w*iMB$SP`(e<+;f zf1ecwd{qnA2#3W5zoUK#(j>qyom&BSv((T)3ewQ)@D;FU$dRysz~m#PrKMahx1^*b zGc&WexR}r9i$o$0hXX(;6qc2hK{g{JgTY{EwOSw)6%{F!N*<4=P$<-DHAKW>G0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aVhbv-&=!%3ufz@409C&AQo`@5j klAh+yd`hWVOPGm4Gd1pE*J7FNz`$qlboFyt=akR{01Adt{Qv*} literal 0 HcmV?d00001 diff --git a/Source/Resources/Images/Images.xcassets/PrefToolbar-Experiences.iconset/icon_32x32@2x.png b/Source/Resources/Images/Images.xcassets/PrefToolbar-Experiences.iconset/icon_32x32@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..06c51e4a659d78316115ba8d5882395245663b82 GIT binary patch literal 1176 zcmX9+3ox5m6#f&h)}z(#AmUYQF{@~I7>d?olZIA3f@znkY8CCUeZ*9}BFRd;UrDH> zUJ3EYOh~nql9cN0EpGf24iX{5@c1Xix;6a5HFR zWQ4_HwY0R9l#~<~7pv9k?CfkZnOsm%z~OM1OlCzz1&v1Ia=CES+uNI;pP!YLC6P#g z!{_tA(12N9UQVG7$LLBmf797AI2+#$cPKO8p7|?E{rXkuJX*oyI3(g?e*7!YwW9HXF#w{Ym&@=I6`SnU#t{T56Om zoueIE9G~xQsWy(tltWY$`jYj*WjvP`s098xE*?T>k_GYAMf`YpIX)?b_LI53uijcd#Uhoo zFhHmc(6ORs7;ZX~&?m!?@8=>NP0Q!B`wnSfdr&*^Kksv=ZkWxm=SRZt5>rSN+|;Ba ie>UddC&b@gFCARIXB;%xhP1-Jiv;3>aqa$>=>GxL3P(o( literal 0 HcmV?d00001 diff --git a/Source/Resources/Images/Images.xcassets/PrefToolbar-General.iconset/icon_32x32.png b/Source/Resources/Images/Images.xcassets/PrefToolbar-General.iconset/icon_32x32.png new file mode 100644 index 0000000000000000000000000000000000000000..ae3e418639c06ed4fb3970b25557f4ce7c1cf0ed GIT binary patch literal 1164 zcmYjPdo-J87>~G=xU{;1juv&R6+Igr($a~B2yux^ZS7&KN6jv@=y8qUM2LGNatNB6 zQ0bAnmul6~BXrSDJ4UT+U6rIX7(+|g)8?N&=X~G$e81=S{GQ+UzAr5#2&a!SMIjIf zeY_tw6jsX*kG49zv5mzNSTy1>ffxj$y+U_4RujI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FraHDu^TjW9MKeun!<^TWy literal 0 HcmV?d00001 diff --git a/Source/Resources/Images/Images.xcassets/PrefToolbar-Keyboard.iconset/icon_32x32@2x.png b/Source/Resources/Images/Images.xcassets/PrefToolbar-Keyboard.iconset/icon_32x32@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..0306e75eced015dc2d6346a3a5321c6426814fc8 GIT binary patch literal 1383 zcmX|A2~d+)5dH&%fL!G)1w<^+YFoJjL_rb=AjMD#FluRw$Tf-*tU{1G+~FobxI(#- z0Kp^>lqy513QT37LM=g3h&Z*V+=nPP>2{duoB8+c+uiT`cHf(ye$K~J?U2DC1VPli z&JfA4AAE1?w-+SYieqk zOy=#|x0{=ri;9X$N=g_EMnORVm&;8{OG{2pPEAdXi;F8OD=RNAPfSd#uC6XFE`}N^ zm70>0Qd?V_l$7+~!2_901`I$2DOfxnud1pFcnS*(^*v5`)vH#IfEEIBzj z5X{KPfKCz;5}+%9AFu%sW&{b4gBnPI5I{H_4m1pR1@{9Hs22)_kUfw96fCHREYyIL zo}La7xG|UrBw$kL3Kpae9tD8l!}vfBig20WfG9Ni{}fOl5C|YUJUk4qlk>R#v>-!FsTUJiadvcbWD)NUNPYr0;yzt*SzKwdPu*B4V7BD)e zV%7 zTe}t8-EiY`g08QR;e(zNf7A3f`r;qmkH*qe!)T8_{jz5@?MZ33FfJ4{3nxnwUQ!T&G*g(eWP*3JBvnNANF`u&N zvmCRXHZ9>=v~ApVTjhpeI+q(`jy}v;QyvZevrSZo8tB##wjxhd^?w1Qe@o70P4M!AGHQ%;R&pzTm%{}UK{298DwolmtE{fIZYDX$(&#v(pErW_~K z5HX*9k5`k}D6UwgdTXzg@hl%&Nj|@nx?mfqMB1Z~_*1wxEGj+N!c{{*C;HVbAyN9> zH1%a$b`3kv^!iL$m75XOr7lEOMN6g_H{!kPxH4g>Z2j_HP<4Ie+^fLj<%(SM*1h;b zYi5Ujq~5^WZK`!)dutHG851uV8+q~r;ugA>ul-Cx!MlG#$4XcGcdz;caw2gH?J+R9 zesR5a!aeq)PTm^MW5dlGvsf`n8EhHTt(RPG&E2<0=dKoxn;ZS18R8LEu&Nl)*GZXF zZ47DY=?KK4%9U@X6!#3Vd}GZ?om;M4(!y@3PM5Flb2UdRnPEgH*?3&Vk$nrx<9HsQ zFWugz?z9eS`OnwRsc$Uc`eyE!if?e5gR^4C-%d(xJ-sX)J>d%f4C3YPLln4PO8Xa5Hnc?m literal 0 HcmV?d00001 diff --git a/Source/WindowControllers/ctlPrefWindow.swift b/Source/WindowControllers/ctlPrefWindow.swift index 9d08bd8f..fe1d8d14 100644 --- a/Source/WindowControllers/ctlPrefWindow.swift +++ b/Source/WindowControllers/ctlPrefWindow.swift @@ -375,7 +375,7 @@ extension ctlPrefWindow: NSToolbarDelegate { systemSymbolName: "wrench.and.screwdriver.fill", accessibilityDescription: "General Preferences" ) } else { - item.image = NSImage(named: NSImage.homeTemplateName) + item.image = NSImage(named: "PrefToolbar-General") } item.action = #selector(showGeneralView(_:)) @@ -387,7 +387,7 @@ extension ctlPrefWindow: NSToolbarDelegate { systemSymbolName: "person.fill.questionmark", accessibilityDescription: "Experiences Preferences" ) } else { - item.image = NSImage(named: NSImage.flowViewTemplateName) + item.image = NSImage(named: "PrefToolbar-Experiences") } item.action = #selector(showExperienceView(_:)) @@ -399,7 +399,7 @@ extension ctlPrefWindow: NSToolbarDelegate { systemSymbolName: "character.book.closed.fill", accessibilityDescription: "Dictionary Preferences" ) } else { - item.image = NSImage(named: NSImage.bookmarksTemplateName) + item.image = NSImage(named: "PrefToolbar-Dictionary") } item.action = #selector(showDictionaryView(_:)) @@ -409,7 +409,7 @@ extension ctlPrefWindow: NSToolbarDelegate { if #available(macOS 11.0, *) { item.image = NSImage(systemSymbolName: "keyboard.macwindow", accessibilityDescription: "Keyboard Preferences") } else { - item.image = NSImage(named: NSImage.slideshowTemplateName) + item.image = NSImage(named: "PrefToolbar-Keyboard") } item.action = #selector(showKeyboardView(_:)) From 9a7186b3ba0bac125afd33caed6f9bbdd6b25ba4 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Wed, 10 Aug 2022 19:07:05 +0800 Subject: [PATCH 12/21] Repo // Megrez v2.0.1 update. - Stop overfixing in fetchOverlappingNodes(). --- Source/Modules/LanguageParsers/Megrez/4_Span.swift | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Source/Modules/LanguageParsers/Megrez/4_Span.swift b/Source/Modules/LanguageParsers/Megrez/4_Span.swift index 9d7efb30..73209391 100644 --- a/Source/Modules/LanguageParsers/Megrez/4_Span.swift +++ b/Source/Modules/LanguageParsers/Megrez/4_Span.swift @@ -79,12 +79,8 @@ extension Megrez.Compositor { // 再獲取以當前位置結尾或開頭的節點。 let begin: Int = location - min(location, Megrez.Compositor.maxSpanLength - 1) for theLocation in begin.. Date: Thu, 11 Aug 2022 11:32:59 +0800 Subject: [PATCH 13/21] Repo // Clang-format. --- Source/Modules/ControllerModules/KeyHandler_HandleInput.swift | 3 ++- Source/Modules/ControllerModules/ctlInputMethod_Core.swift | 4 ++-- Source/Modules/LangModelRelated/LMInstantiator.swift | 2 +- Source/Modules/LangModelRelated/SubLMs/lmPlainBopomofo.swift | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Source/Modules/ControllerModules/KeyHandler_HandleInput.swift b/Source/Modules/ControllerModules/KeyHandler_HandleInput.swift index 28a41c64..984a7948 100644 --- a/Source/Modules/ControllerModules/KeyHandler_HandleInput.swift +++ b/Source/Modules/ControllerModules/KeyHandler_HandleInput.swift @@ -387,7 +387,8 @@ extension KeyHandler { return true default: // 包括 case 0,直接塞給組字區。 let letter: String! = String( - format: "%@%c", "_letter_", charCode.isPrintableASCII ? CChar(charCode) : inputText) + format: "%@%c", "_letter_", charCode.isPrintableASCII ? CChar(charCode) : inputText + ) if handlePunctuation( letter, state: state, diff --git a/Source/Modules/ControllerModules/ctlInputMethod_Core.swift b/Source/Modules/ControllerModules/ctlInputMethod_Core.swift index 4cfd244e..02c59768 100644 --- a/Source/Modules/ControllerModules/ctlInputMethod_Core.swift +++ b/Source/Modules/ControllerModules/ctlInputMethod_Core.swift @@ -195,8 +195,8 @@ class ctlInputMethod: IMKInputController { message: String( format: "%@%@%@", NSLocalizedString("Alphanumerical Mode", comment: ""), "\n", toggleASCIIMode() - ? NSLocalizedString("NotificationSwitchON", comment: "") - : NSLocalizedString("NotificationSwitchOFF", comment: "") + ? NSLocalizedString("NotificationSwitchON", comment: "") + : NSLocalizedString("NotificationSwitchOFF", comment: "") ) ) } diff --git a/Source/Modules/LangModelRelated/LMInstantiator.swift b/Source/Modules/LangModelRelated/LMInstantiator.swift index ad8f742e..9237f4fc 100644 --- a/Source/Modules/LangModelRelated/LMInstantiator.swift +++ b/Source/Modules/LangModelRelated/LMInstantiator.swift @@ -194,7 +194,7 @@ extension vChewing { // 如果有檢測到使用者自訂逐字選字語料庫內的相關資料的話,在這裡先插入。 if mgrPrefs.useSCPCTypingMode { - rawAllUnigrams += lmPlainBopomofo.valuesFor(key: key).map { Megrez.Unigram.init(value: $0, score: 0) } + rawAllUnigrams += lmPlainBopomofo.valuesFor(key: key).map { Megrez.Unigram(value: $0, score: 0) } } // 用 reversed 指令讓使用者語彙檔案內的詞條優先順序隨著行數增加而逐漸增高。 diff --git a/Source/Modules/LangModelRelated/SubLMs/lmPlainBopomofo.swift b/Source/Modules/LangModelRelated/SubLMs/lmPlainBopomofo.swift index 356bcce3..6a689e5c 100644 --- a/Source/Modules/LangModelRelated/SubLMs/lmPlainBopomofo.swift +++ b/Source/Modules/LangModelRelated/SubLMs/lmPlainBopomofo.swift @@ -58,7 +58,7 @@ extension vChewing { public func valuesFor(key: String) -> [String] { var pairs: [String] = [] if let arrRangeRecords: String = rangeMap[key] { - pairs.append(contentsOf: arrRangeRecords.map({ String($0) })) + pairs.append(contentsOf: arrRangeRecords.map { String($0) }) } var set = Set() return pairs.filter { set.insert($0).inserted } From 43db1cb7e5b3319e584914e8e2f5b8f8cc144fad Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Thu, 11 Aug 2022 13:05:28 +0800 Subject: [PATCH 14/21] PrefWindow // Fix "UseRearCursorMode". --- Source/Modules/IMEModules/mgrPrefs.swift | 2 +- Source/WindowNIBs/Base.lproj/frmPrefWindow.xib | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Modules/IMEModules/mgrPrefs.swift b/Source/Modules/IMEModules/mgrPrefs.swift index 541e5ff2..c766ad1a 100644 --- a/Source/Modules/IMEModules/mgrPrefs.swift +++ b/Source/Modules/IMEModules/mgrPrefs.swift @@ -23,7 +23,7 @@ public enum UserDef: String, CaseIterable { case kCandidateListTextSize = "CandidateListTextSize" case kAppleLanguages = "AppleLanguages" case kShouldAutoReloadUserDataFiles = "ShouldAutoReloadUserDataFiles" - case kUseRearCursorMode = "useRearCursorMode" + case kUseRearCursorMode = "UseRearCursorMode" case kUseHorizontalCandidateList = "UseHorizontalCandidateList" case kChooseCandidateUsingSpace = "ChooseCandidateUsingSpace" case kCNS11643Enabled = "CNS11643Enabled" diff --git a/Source/WindowNIBs/Base.lproj/frmPrefWindow.xib b/Source/WindowNIBs/Base.lproj/frmPrefWindow.xib index 4ba628a9..b9b3661b 100644 --- a/Source/WindowNIBs/Base.lproj/frmPrefWindow.xib +++ b/Source/WindowNIBs/Base.lproj/frmPrefWindow.xib @@ -410,7 +410,7 @@ - +