2.6.2 SP3 // Tooltip fix. Merge PR #140 from upd/2.6.2sp3

This commit is contained in:
ShikiSuen 2022-09-19 15:39:26 +08:00 committed by GitHub
commit 0a1e855d9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 27 additions and 17 deletions

1
.gitignore vendored
View File

@ -8,7 +8,6 @@ $tf/
**/*.HTMLClient/GeneratedArtifacts
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
**/[Pp]ackages/*
*.app
*.appx
*.aps

@ -1 +1 @@
Subproject commit e3277eaff3592b356f76f50362de56bdf6ed927c
Subproject commit 260a1dfbb383fd0e9c8affa8d1d8c08bf378a5b2

View File

@ -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),

View File

@ -58,6 +58,15 @@ extension ctlInputMethod {
if mgrPrefs.alwaysShowTooltipTextsHorizontally { return .horizontal }
return isVerticalTyping ? .vertical : .horizontal
}()
// NSAttributedTextView
do {
ctlInputMethod.tooltipInstance.hide()
ctlInputMethod.tooltipInstance = .init()
if state.type == .ofMarking {
ctlInputMethod.tooltipInstance.setColor(state: state.data.tooltipColorState)
}
}
//
ctlInputMethod.tooltipInstance.show(
tooltip: tooltip, at: finalOrigin,
bottomOutOfScreenAdjustmentHeight: delta, direction: tooltipContentDirection

View File

@ -477,7 +477,7 @@ public enum mgrPrefs {
@UserDefault(key: UserDef.kMaxCandidateLength.rawValue, defaultValue: 10)
static var maxCandidateLength: Int
static var allowedMarkLengthRange: ClosedRange<Int> = mgrPrefs.minCandidateLength...mgrPrefs.maxCandidateLength
static var allowedMarkLengthRange: ClosedRange<Int> { mgrPrefs.minCandidateLength...mgrPrefs.maxCandidateLength }
@UserDefault(key: UserDef.kShouldNotFartInLieuOfBeep.rawValue, defaultValue: true)
static var shouldNotFartInLieuOfBeep: Bool

View File

@ -5,7 +5,7 @@
<key>CFBundleShortVersionString</key>
<string>2.6.2</string>
<key>CFBundleVersion</key>
<string>2621</string>
<string>2623</string>
<key>UpdateInfoEndpoint</key>
<string>https://gitee.com/vchewing/vChewing-macOS/raw/main/Update-Info.plist</string>
<key>UpdateInfoSite</key>

View File

@ -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;