KeyHandler // Simplify certain if conditions.

This commit is contained in:
ShikiSuen 2022-06-29 12:45:53 +08:00
parent dbe54d7a8b
commit 9487a13159
1 changed files with 5 additions and 7 deletions

View File

@ -137,15 +137,13 @@ class KeyHandler {
/// ///
var popOverflowComposingTextAndWalk: String { var popOverflowComposingTextAndWalk: String {
var textToCommit = "" var textToCommit = ""
if compositor.grid.width > mgrPrefs.composingBufferSize { if compositor.grid.width > mgrPrefs.composingBufferSize, !walkedAnchors.isEmpty {
if !walkedAnchors.isEmpty {
let anchor: Megrez.NodeAnchor = walkedAnchors[0] let anchor: Megrez.NodeAnchor = walkedAnchors[0]
if let theNode = anchor.node { if let theNode = anchor.node {
textToCommit = theNode.currentKeyValue.value textToCommit = theNode.currentKeyValue.value
} }
compositor.removeHeadReadings(count: anchor.spanningLength) compositor.removeHeadReadings(count: anchor.spanningLength)
} }
}
walk() walk()
return textToCommit return textToCommit
} }