SessionCtl // Again clearInlineDisplay() on deactivation.
* Also optimize doSetMarkedText().
This commit is contained in:
parent
fef6eb5f76
commit
99275a4682
|
@ -48,6 +48,10 @@ public extension SessionCtl {
|
||||||
candidateUI?.visible = false
|
candidateUI?.visible = false
|
||||||
popupCompositionBuffer.hide()
|
popupCompositionBuffer.hide()
|
||||||
tooltipInstance.hide()
|
tooltipInstance.hide()
|
||||||
|
inputHandler?.clear()
|
||||||
|
if ![.ofAbortion, .ofEmpty].contains(previous.type), !previous.displayedText.isEmpty {
|
||||||
|
clearInlineDisplay()
|
||||||
|
}
|
||||||
case .ofEmpty, .ofAbortion, .ofCommitting:
|
case .ofEmpty, .ofAbortion, .ofCommitting:
|
||||||
innerCircle: switch newState.type {
|
innerCircle: switch newState.type {
|
||||||
case .ofAbortion:
|
case .ofAbortion:
|
||||||
|
@ -137,12 +141,13 @@ public extension SessionCtl {
|
||||||
|
|
||||||
/// 把 setMarkedText 包裝一下,按需啟用 GCD。
|
/// 把 setMarkedText 包裝一下,按需啟用 GCD。
|
||||||
func doSetMarkedText(_ string: Any!, selectionRange: NSRange, replacementRange: NSRange) {
|
func doSetMarkedText(_ string: Any!, selectionRange: NSRange, replacementRange: NSRange) {
|
||||||
guard isActivated, let client = client() else { return }
|
if isServingIMEItself || !isActivated {
|
||||||
if isServingIMEItself {
|
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
|
guard let client = self.client() else { return }
|
||||||
client.setMarkedText(string, selectionRange: selectionRange, replacementRange: replacementRange)
|
client.setMarkedText(string, selectionRange: selectionRange, replacementRange: replacementRange)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
guard let client = client() else { return }
|
||||||
client.setMarkedText(string, selectionRange: selectionRange, replacementRange: replacementRange)
|
client.setMarkedText(string, selectionRange: selectionRange, replacementRange: replacementRange)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue