From ddd8b5d607b7dfa2f20aa06ee29c5cb1f00780c2 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Mon, 19 Sep 2022 12:50:47 +0800 Subject: [PATCH 1/6] ctlIME // Force reinitiate ctlTooltip when show(). --- .../ControllerModules/ctlInputMethod_HandleDisplay.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Source/Modules/ControllerModules/ctlInputMethod_HandleDisplay.swift b/Source/Modules/ControllerModules/ctlInputMethod_HandleDisplay.swift index a3d64931..77946bad 100644 --- a/Source/Modules/ControllerModules/ctlInputMethod_HandleDisplay.swift +++ b/Source/Modules/ControllerModules/ctlInputMethod_HandleDisplay.swift @@ -58,6 +58,12 @@ extension ctlInputMethod { if mgrPrefs.alwaysShowTooltipTextsHorizontally { return .horizontal } return isVerticalTyping ? .vertical : .horizontal }() + // 強制重新初期化,因為 NSAttributedTextView 有顯示滯後性。 + do { + ctlInputMethod.tooltipInstance.hide() + ctlInputMethod.tooltipInstance = .init() + } + // 再設定其文字顯示內容並顯示。 ctlInputMethod.tooltipInstance.show( tooltip: tooltip, at: finalOrigin, bottomOutOfScreenAdjustmentHeight: delta, direction: tooltipContentDirection From f02cb01a24e2465ec4c894b6b2f0fd7b63dc81b3 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Fri, 16 Sep 2022 16:46:59 +0800 Subject: [PATCH 2/6] Git // Allow Swift packages to be registered. --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index 110c2978..49b6f218 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,6 @@ $tf/ **/*.HTMLClient/GeneratedArtifacts **/*.Server/GeneratedArtifacts **/*.Server/ModelManifest.xml -**/[Pp]ackages/* *.app *.appx *.aps From d06d81829d183a801bb487a52fa58a80bf924988 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Mon, 19 Sep 2022 14:20:25 +0800 Subject: [PATCH 3/6] mgrPrefs // Force minimum mark length to reflect changes. --- Source/Modules/IMEModules/mgrPrefs.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Modules/IMEModules/mgrPrefs.swift b/Source/Modules/IMEModules/mgrPrefs.swift index 72afc32b..614b9f06 100644 --- a/Source/Modules/IMEModules/mgrPrefs.swift +++ b/Source/Modules/IMEModules/mgrPrefs.swift @@ -477,7 +477,7 @@ public enum mgrPrefs { @UserDefault(key: UserDef.kMaxCandidateLength.rawValue, defaultValue: 10) static var maxCandidateLength: Int - static var allowedMarkLengthRange: ClosedRange = mgrPrefs.minCandidateLength...mgrPrefs.maxCandidateLength + static var allowedMarkLengthRange: ClosedRange { mgrPrefs.minCandidateLength...mgrPrefs.maxCandidateLength } @UserDefault(key: UserDef.kShouldNotFartInLieuOfBeep.rawValue, defaultValue: true) static var shouldNotFartInLieuOfBeep: Bool From 1c249d7818dfd5e5e44f48e45e52c9659e0c22af Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Mon, 19 Sep 2022 15:16:00 +0800 Subject: [PATCH 4/6] Repo // Reenable tooltip color sync. --- Source/Modules/ControllerModules/IMEStateData.swift | 12 +++++++----- .../ctlInputMethod_HandleDisplay.swift | 3 +++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Source/Modules/ControllerModules/IMEStateData.swift b/Source/Modules/ControllerModules/IMEStateData.swift index a96dc43e..096dbeee 100644 --- a/Source/Modules/ControllerModules/IMEStateData.swift +++ b/Source/Modules/ControllerModules/IMEStateData.swift @@ -86,6 +86,8 @@ public struct StateData { mgrPrefs.allowedMarkLengthRange.contains(markedRange.count) } + var tooltipColorState: ctlTooltip.ColorStates = .normal + var attributedStringNormal: NSAttributedString { /// 考慮到因為滑鼠點擊等其它行為導致的組字區內容遞交情況, /// 這裡對組字區內容也加上康熙字轉換或者 JIS 漢字轉換處理。 @@ -197,7 +199,7 @@ extension StateData { public static func updateParameters(_ data: inout StateData) { var tooltipGenerated: String { if mgrPrefs.phraseReplacementEnabled { - ctlInputMethod.tooltipInstance.setColor(state: .warning) + data.tooltipColorState = .warning return NSLocalizedString( "⚠︎ Phrase replacement mode enabled, interfering user phrase entry.", comment: "" ) @@ -208,14 +210,14 @@ extension StateData { let text = data.displayedText.charComponents[data.markedRange].joined() if data.markedRange.count < mgrPrefs.allowedMarkLengthRange.lowerBound { - ctlInputMethod.tooltipInstance.setColor(state: .denialInsufficiency) + data.tooltipColorState = .denialInsufficiency return String( format: NSLocalizedString( "\"%@\" length must ≥ 2 for a user phrase.", comment: "" ) + "\n◆ " + generateReadingThread(data), text ) } else if data.markedRange.count > mgrPrefs.allowedMarkLengthRange.upperBound { - ctlInputMethod.tooltipInstance.setColor(state: .denialOverflow) + data.tooltipColorState = .denialOverflow return String( format: NSLocalizedString( "\"%@\" length should ≤ %d for a user phrase.", comment: "" @@ -229,7 +231,7 @@ extension StateData { ) if exist { data.markedTargetExists = exist - ctlInputMethod.tooltipInstance.setColor(state: .prompt) + data.tooltipColorState = .prompt return String( format: NSLocalizedString( "\"%@\" already exists:\n ENTER to boost, SHIFT+COMMAND+ENTER to nerf, \n BackSpace or Delete key to exclude.", @@ -237,7 +239,7 @@ extension StateData { ) + "\n◆ " + generateReadingThread(data), text ) } - ctlInputMethod.tooltipInstance.resetColor() + data.tooltipColorState = .normal return String( format: NSLocalizedString("\"%@\" selected. ENTER to add user phrase.", comment: "") + "\n◆ " + generateReadingThread(data), diff --git a/Source/Modules/ControllerModules/ctlInputMethod_HandleDisplay.swift b/Source/Modules/ControllerModules/ctlInputMethod_HandleDisplay.swift index 77946bad..32457db4 100644 --- a/Source/Modules/ControllerModules/ctlInputMethod_HandleDisplay.swift +++ b/Source/Modules/ControllerModules/ctlInputMethod_HandleDisplay.swift @@ -62,6 +62,9 @@ extension ctlInputMethod { do { ctlInputMethod.tooltipInstance.hide() ctlInputMethod.tooltipInstance = .init() + if state.type == .ofMarking { + ctlInputMethod.tooltipInstance.setColor(state: state.data.tooltipColorState) + } } // 再設定其文字顯示內容並顯示。 ctlInputMethod.tooltipInstance.show( From b9f55b7c548d398c7dccd0dfb23e5f97a69cc1d5 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Mon, 19 Sep 2022 14:44:29 +0800 Subject: [PATCH 5/6] Update Data - 20220919 --- Source/Data | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Data b/Source/Data index e3277eaf..260a1dfb 160000 --- a/Source/Data +++ b/Source/Data @@ -1 +1 @@ -Subproject commit e3277eaff3592b356f76f50362de56bdf6ed927c +Subproject commit 260a1dfbb383fd0e9c8affa8d1d8c08bf378a5b2 From 9ae78206b43fc3fbf30cb7b3d1fb5cd68ef3e81b Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Mon, 19 Sep 2022 14:44:53 +0800 Subject: [PATCH 6/6] Bump version to 2.6.2 Build 2623. --- Update-Info.plist | 2 +- vChewing.xcodeproj/project.pbxproj | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Update-Info.plist b/Update-Info.plist index ffdc5d8f..1715c3d1 100644 --- a/Update-Info.plist +++ b/Update-Info.plist @@ -5,7 +5,7 @@ CFBundleShortVersionString 2.6.2 CFBundleVersion - 2621 + 2623 UpdateInfoEndpoint https://gitee.com/vchewing/vChewing-macOS/raw/main/Update-Info.plist UpdateInfoSite diff --git a/vChewing.xcodeproj/project.pbxproj b/vChewing.xcodeproj/project.pbxproj index 68891ffc..2b246ba3 100644 --- a/vChewing.xcodeproj/project.pbxproj +++ b/vChewing.xcodeproj/project.pbxproj @@ -1510,7 +1510,7 @@ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 2621; + CURRENT_PROJECT_VERSION = 2623; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_DYNAMIC_NO_PIC = NO; GCC_PREPROCESSOR_DEFINITIONS = ( @@ -1549,7 +1549,7 @@ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 2621; + CURRENT_PROJECT_VERSION = 2623; ENABLE_NS_ASSERTIONS = NO; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; @@ -1587,7 +1587,7 @@ CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 2621; + CURRENT_PROJECT_VERSION = 2623; DEAD_CODE_STRIPPING = YES; ENABLE_HARDENED_RUNTIME = YES; GCC_C_LANGUAGE_STANDARD = gnu11; @@ -1639,7 +1639,7 @@ CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 2621; + CURRENT_PROJECT_VERSION = 2623; DEAD_CODE_STRIPPING = YES; ENABLE_HARDENED_RUNTIME = YES; ENABLE_NS_ASSERTIONS = NO; @@ -1773,7 +1773,7 @@ CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 2621; + CURRENT_PROJECT_VERSION = 2623; DEAD_CODE_STRIPPING = YES; DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_TEAM = ""; @@ -1832,7 +1832,7 @@ CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 2621; + CURRENT_PROJECT_VERSION = 2623; DEAD_CODE_STRIPPING = YES; DEVELOPMENT_ASSET_PATHS = ""; DEVELOPMENT_TEAM = ""; @@ -1878,7 +1878,7 @@ CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 2621; + CURRENT_PROJECT_VERSION = 2623; DEAD_CODE_STRIPPING = YES; DEVELOPMENT_TEAM = ""; ENABLE_HARDENED_RUNTIME = NO; @@ -1921,7 +1921,7 @@ CODE_SIGN_IDENTITY = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 2621; + CURRENT_PROJECT_VERSION = 2623; DEAD_CODE_STRIPPING = YES; DEVELOPMENT_TEAM = ""; ENABLE_HARDENED_RUNTIME = NO;