diff --git a/Packages/vChewing_Shared/Sources/Shared/Protocols/IMEStateProtocol.swift b/Packages/vChewing_Shared/Sources/Shared/Protocols/IMEStateProtocol.swift index ba4ed5dd..5825b639 100644 --- a/Packages/vChewing_Shared/Sources/Shared/Protocols/IMEStateProtocol.swift +++ b/Packages/vChewing_Shared/Sources/Shared/Protocols/IMEStateProtocol.swift @@ -22,6 +22,7 @@ public protocol IMEStateProtocol { var displayedTextConverted: String { get } var textToCommit: String { get set } var tooltip: String { get set } + var tooltipDuration: Double { get set } var attributedString: NSAttributedString { get } var convertedToInputting: IMEStateProtocol { get } var isFilterable: Bool { get } @@ -53,6 +54,7 @@ public protocol IMEStateDataProtocol { var displayedTextConverted: String { get } var tooltipBackupForInputting: String { get set } var tooltip: String { get set } + var tooltipDuration: Double { get set } var attributedStringNormal: NSAttributedString { get } var attributedStringMarking: NSAttributedString { get } var attributedStringPlaceholder: NSAttributedString { get } diff --git a/Source/Modules/IMEState.swift b/Source/Modules/IMEState.swift index 289cc483..f9cbfa51 100644 --- a/Source/Modules/IMEState.swift +++ b/Source/Modules/IMEState.swift @@ -225,4 +225,9 @@ extension IMEState { get { data.tooltipBackupForInputting } set { data.tooltipBackupForInputting = newValue } } + + public var tooltipDuration: Double { + get { type == .ofMarking ? 0 : data.tooltipDuration } + set { data.tooltipDuration = newValue } + } } diff --git a/Source/Modules/IMEStateData.swift b/Source/Modules/IMEStateData.swift index ea4279dd..31a85948 100644 --- a/Source/Modules/IMEStateData.swift +++ b/Source/Modules/IMEStateData.swift @@ -94,6 +94,7 @@ public struct IMEStateData: IMEStateDataProtocol { public var candidates = [(String, String)]() public var textToCommit: String = "" public var tooltip: String = "" + public var tooltipDuration: Double = 1.0 public var tooltipBackupForInputting: String = "" public var attributedStringPlaceholder: NSAttributedString = .init( string: " ",