SessionCtl // Again clearInlineDisplay() on deactivation.

* Also optimize doSetMarkedText().
This commit is contained in:
ShikiSuen 2023-02-09 16:42:21 +08:00
parent fef6eb5f76
commit 99275a4682
1 changed files with 7 additions and 2 deletions

View File

@ -48,6 +48,10 @@ public extension SessionCtl {
candidateUI?.visible = false
popupCompositionBuffer.hide()
tooltipInstance.hide()
inputHandler?.clear()
if ![.ofAbortion, .ofEmpty].contains(previous.type), !previous.displayedText.isEmpty {
clearInlineDisplay()
}
case .ofEmpty, .ofAbortion, .ofCommitting:
innerCircle: switch newState.type {
case .ofAbortion:
@ -137,12 +141,13 @@ public extension SessionCtl {
/// setMarkedText GCD
func doSetMarkedText(_ string: Any!, selectionRange: NSRange, replacementRange: NSRange) {
guard isActivated, let client = client() else { return }
if isServingIMEItself {
if isServingIMEItself || !isActivated {
DispatchQueue.main.async {
guard let client = self.client() else { return }
client.setMarkedText(string, selectionRange: selectionRange, replacementRange: replacementRange)
}
} else {
guard let client = client() else { return }
client.setMarkedText(string, selectionRange: selectionRange, replacementRange: replacementRange)
}
}