KeyHandler // Use guard-let instead in some functions.

This commit is contained in:
ShikiSuen 2022-06-29 13:38:28 +08:00
parent f768d6c603
commit f4894e5828
2 changed files with 44 additions and 46 deletions

View File

@ -249,7 +249,7 @@ class KeyHandler {
// //
for currentNodeAnchor in arrAnchors { for currentNodeAnchor in arrAnchors {
if let currentNode = currentNodeAnchor.node { guard let currentNode = currentNodeAnchor.node else { continue }
for currentCandidate in currentNode.candidates { for currentCandidate in currentNode.candidates {
// / JIS // / JIS
// //
@ -257,7 +257,6 @@ class KeyHandler {
arrCandidates.append(currentCandidate.value) arrCandidates.append(currentCandidate.value)
} }
} }
}
// 調 // 調
if !mgrPrefs.fetchSuggestionsFromUserOverrideModel || mgrPrefs.useSCPCTypingMode || fixOrder { if !mgrPrefs.fetchSuggestionsFromUserOverrideModel || mgrPrefs.useSCPCTypingMode || fixOrder {
return arrCandidates return arrCandidates

View File

@ -45,7 +45,7 @@ extension KeyHandler {
/// Swift.utf16NSString.length() /// Swift.utf16NSString.length()
/// ///
for theAnchor in walkedAnchors { for theAnchor in walkedAnchors {
if let theNode = theAnchor.node { guard let theNode = theAnchor.node else { continue }
let strNodeValue = theNode.currentKeyValue.value let strNodeValue = theNode.currentKeyValue.value
composingBuffer += strNodeValue composingBuffer += strNodeValue
let arrSplit: [String] = Array(strNodeValue).map { String($0) } let arrSplit: [String] = Array(strNodeValue).map { String($0) }
@ -90,7 +90,6 @@ extension KeyHandler {
} }
} }
} }
}
/// ///
/// 便 composer /// 便 composer