KeyHandler // Use guard-let instead in some functions.
This commit is contained in:
parent
f768d6c603
commit
f4894e5828
|
@ -249,7 +249,7 @@ class KeyHandler {
|
|||
|
||||
// 將節錨內的候選字詞資料拓印到輸出陣列內。
|
||||
for currentNodeAnchor in arrAnchors {
|
||||
if let currentNode = currentNodeAnchor.node {
|
||||
guard let currentNode = currentNodeAnchor.node else { continue }
|
||||
for currentCandidate in currentNode.candidates {
|
||||
// 選字窗的內容的康熙轉換 / JIS 轉換不能放在這裡處理,會影響選字有效性。
|
||||
// 選字的原理是拿著具體的候選字詞的字串去當前的節錨下找出對應的候選字詞(X元圖)。
|
||||
|
@ -257,7 +257,6 @@ class KeyHandler {
|
|||
arrCandidates.append(currentCandidate.value)
|
||||
}
|
||||
}
|
||||
}
|
||||
// 決定是否根據半衰記憶模組的建議來調整候選字詞的順序。
|
||||
if !mgrPrefs.fetchSuggestionsFromUserOverrideModel || mgrPrefs.useSCPCTypingMode || fixOrder {
|
||||
return arrCandidates
|
||||
|
|
|
@ -45,7 +45,7 @@ extension KeyHandler {
|
|||
/// 所以在這裡必須做糾偏處理。因為在用 Swift,所以可以用「.utf16」取代「NSString.length()」。
|
||||
/// 這樣就可以免除不必要的類型轉換。
|
||||
for theAnchor in walkedAnchors {
|
||||
if let theNode = theAnchor.node {
|
||||
guard let theNode = theAnchor.node else { continue }
|
||||
let strNodeValue = theNode.currentKeyValue.value
|
||||
composingBuffer += strNodeValue
|
||||
let arrSplit: [String] = Array(strNodeValue).map { String($0) }
|
||||
|
@ -90,7 +90,6 @@ extension KeyHandler {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// 再接下來,藉由已經計算成功的「可見游標位置」,咱們計算一下在這個游標之前與之後的
|
||||
/// 組字區內容,以便之後在這之間插入正在輸入的漢字讀音(藉由鐵恨 composer 注拼槽取得)。
|
||||
|
|
Loading…
Reference in New Issue