diff --git a/Source/Modules/AppDelegate.swift b/Source/Modules/AppDelegate.swift index a63a4e94..5ea0b4c8 100644 --- a/Source/Modules/AppDelegate.swift +++ b/Source/Modules/AppDelegate.swift @@ -29,7 +29,7 @@ import InputMethodKit @objc(AppDelegate) class AppDelegate: NSObject, NSApplicationDelegate, ctlNonModalAlertWindowDelegate, - FSEventStreamHelperDelegate + FSEventStreamHelperDelegate, NSUserNotificationCenterDelegate { func helper(_: FSEventStreamHelper, didReceive _: [FSEventStreamHelper.Event]) { // 拖 100ms 再重載,畢竟有些有特殊需求的使用者可能會想使用巨型自訂語彙檔案。 @@ -63,13 +63,25 @@ class AppDelegate: NSObject, NSApplicationDelegate, ctlNonModalAlertWindowDelega fsStreamHelper.delegate = nil } + func userNotificationCenter(_: NSUserNotificationCenter, shouldPresent _: NSUserNotification) -> Bool { + return true + } + func applicationDidFinishLaunching(_: Notification) { + NSUserNotificationCenter.default.delegate = self // 一旦發現與使用者半衰模組的觀察行為有關的崩潰標記被開啟,就清空既有的半衰記憶資料檔案。 if mgrPrefs.failureFlagForUOMObservation { mgrLangModel.clearUserOverrideModelData(.imeModeCHS) mgrLangModel.clearUserOverrideModelData(.imeModeCHT) mgrPrefs.failureFlagForUOMObservation = false + let userNotification = NSUserNotification() + userNotification.title = NSLocalizedString("vChewing", comment: "") + userNotification.informativeText = + "\(NSLocalizedString("vChewing crashed while handling previously loaded UOM observation data. These data files are cleaned now to ensure the usability.", comment: ""))" + userNotification.soundName = NSUserNotificationDefaultSoundName + NSUserNotificationCenter.default.deliver(userNotification) } + DispatchQueue.main.asyncAfter(deadline: DispatchTime.now()) { IME.initLangModels(userOnly: false) } diff --git a/Source/Modules/ControllerModules/InputState.swift b/Source/Modules/ControllerModules/InputState.swift index 74026bc6..9bf30f6c 100644 --- a/Source/Modules/ControllerModules/InputState.swift +++ b/Source/Modules/ControllerModules/InputState.swift @@ -201,7 +201,8 @@ public enum InputState { let attributedString = NSMutableAttributedString( string: composingBufferConverted, attributes: [ - .underlineStyle: NSUnderlineStyle.thick.rawValue, + /// 不能用 .thick,否則會看不到游標。 + .underlineStyle: NSUnderlineStyle.single.rawValue, .markedClauseSegment: 0, ] ) @@ -212,7 +213,8 @@ public enum InputState { for (i, neta) in nodeValuesArray.enumerated() { attributedString.setAttributes( [ - .underlineStyle: NSUnderlineStyle.thick.rawValue, + /// 不能用 .thick,否則會看不到游標。 + .underlineStyle: NSUnderlineStyle.single.rawValue, .markedClauseSegment: i, ], range: NSRange(location: newBegin, length: neta.utf16.count) ) diff --git a/Source/Resources/Base.lproj/Localizable.strings b/Source/Resources/Base.lproj/Localizable.strings index 3d21a518..7fdaca04 100644 --- a/Source/Resources/Base.lproj/Localizable.strings +++ b/Source/Resources/Base.lproj/Localizable.strings @@ -1,3 +1,5 @@ +"vChewing" = "vChewing"; +"vChewing crashed while handling previously loaded UOM observation data. These data files are cleaned now to ensure the usability." = "vChewing crashed while handling previously loaded UOM observation data. These data files are cleaned now to ensure the usability."; "About vChewing…" = "About vChewing…"; "vChewing Preferences…" = "vChewing Preferences…"; "Uninstallation" = "Uninstallation"; diff --git a/Source/Resources/en.lproj/Localizable.strings b/Source/Resources/en.lproj/Localizable.strings index 3d21a518..7fdaca04 100644 --- a/Source/Resources/en.lproj/Localizable.strings +++ b/Source/Resources/en.lproj/Localizable.strings @@ -1,3 +1,5 @@ +"vChewing" = "vChewing"; +"vChewing crashed while handling previously loaded UOM observation data. These data files are cleaned now to ensure the usability." = "vChewing crashed while handling previously loaded UOM observation data. These data files are cleaned now to ensure the usability."; "About vChewing…" = "About vChewing…"; "vChewing Preferences…" = "vChewing Preferences…"; "Uninstallation" = "Uninstallation"; diff --git a/Source/Resources/ja.lproj/Localizable.strings b/Source/Resources/ja.lproj/Localizable.strings index 1f01eb48..148db8cb 100644 --- a/Source/Resources/ja.lproj/Localizable.strings +++ b/Source/Resources/ja.lproj/Localizable.strings @@ -1,3 +1,5 @@ +"vChewing" = "威注音入力アプリ"; +"vChewing crashed while handling previously loaded UOM observation data. These data files are cleaned now to ensure the usability." = "臨時記憶モジュールの観測行為による威注音入力アプリの意外中止は発生した。威注音入力アプリの無事利用のために、既存臨時記憶データは全てお消しした。"; "About vChewing…" = "威注音について…"; "vChewing Preferences…" = "入力機能設定…"; "Uninstallation" = "入力アプリの卸除(おろしのぞき)"; diff --git a/Source/Resources/zh-Hans.lproj/Localizable.strings b/Source/Resources/zh-Hans.lproj/Localizable.strings index c7a18167..2dc53355 100644 --- a/Source/Resources/zh-Hans.lproj/Localizable.strings +++ b/Source/Resources/zh-Hans.lproj/Localizable.strings @@ -1,3 +1,5 @@ +"vChewing" = "威注音输入法"; +"vChewing crashed while handling previously loaded UOM observation data. These data files are cleaned now to ensure the usability." = "威注音输入法的使用者半衰记忆模组在观测时崩溃,相关半衰记忆资料档案内容已全部清空。"; "About vChewing…" = "关于威注音…"; "vChewing Preferences…" = "威注音偏好设定…"; "Uninstallation" = "卸除输入法"; diff --git a/Source/Resources/zh-Hant.lproj/Localizable.strings b/Source/Resources/zh-Hant.lproj/Localizable.strings index 9f20e73e..09f9c864 100644 --- a/Source/Resources/zh-Hant.lproj/Localizable.strings +++ b/Source/Resources/zh-Hant.lproj/Localizable.strings @@ -1,3 +1,5 @@ +"vChewing" = "威注音輸入法"; +"vChewing crashed while handling previously loaded UOM observation data. These data files are cleaned now to ensure the usability." = "威注音輸入法的使用者半衰記憶模組在觀測時崩潰,相關半衰記憶資料檔案內容已全部清空。"; "About vChewing…" = "關於威注音…"; "vChewing Preferences…" = "威注音偏好設定…"; "Uninstallation" = "卸除輸入法";