SessionCtl // Optimize handlings of Committing() state.
This commit is contained in:
parent
70e0044179
commit
2cf53d5c6a
|
@ -61,15 +61,20 @@ extension SessionCtl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case .ofEmpty, .ofAbortion:
|
case .ofEmpty, .ofAbortion, .ofCommitting:
|
||||||
if newState.type == .ofAbortion {
|
innerCircle: switch newState.type {
|
||||||
previous = IMEState.ofEmpty()
|
case .ofAbortion:
|
||||||
if replace { state = previous }
|
previous = IMEState.ofEmpty()
|
||||||
|
if replace { state = previous }
|
||||||
|
case .ofCommitting:
|
||||||
|
commit(text: newState.textToCommit)
|
||||||
|
state = IMEState.ofEmpty()
|
||||||
|
default: break innerCircle
|
||||||
}
|
}
|
||||||
ctlCandidateCurrent.visible = false
|
ctlCandidateCurrent.visible = false
|
||||||
tooltipInstance.hide()
|
tooltipInstance.hide()
|
||||||
// 全專案用以判斷「.Abortion」的地方僅此一處。
|
// 全專案用以判斷「.Abortion」的地方僅此一處。
|
||||||
if previous.hasComposition, newState.type != .ofAbortion {
|
if previous.hasComposition, ![.ofAbortion, .ofCommitting].contains(newState.type) {
|
||||||
commit(text: previous.displayedText)
|
commit(text: previous.displayedText)
|
||||||
}
|
}
|
||||||
// 在這裡手動再取消一次選字窗與工具提示的顯示,可謂雙重保險。
|
// 在這裡手動再取消一次選字窗與工具提示的顯示,可謂雙重保險。
|
||||||
|
@ -77,13 +82,6 @@ extension SessionCtl {
|
||||||
clearInlineDisplay()
|
clearInlineDisplay()
|
||||||
// 最後一道保險
|
// 最後一道保險
|
||||||
inputHandler.clear()
|
inputHandler.clear()
|
||||||
case .ofCommitting:
|
|
||||||
ctlCandidateCurrent.visible = false
|
|
||||||
tooltipInstance.hide()
|
|
||||||
commit(text: newState.textToCommit)
|
|
||||||
clearInlineDisplay()
|
|
||||||
// 最後一道保險
|
|
||||||
inputHandler.clear()
|
|
||||||
case .ofInputting:
|
case .ofInputting:
|
||||||
ctlCandidateCurrent.visible = false
|
ctlCandidateCurrent.visible = false
|
||||||
tooltipInstance.hide()
|
tooltipInstance.hide()
|
||||||
|
|
Loading…
Reference in New Issue