KeyHandler // Refactor handlePunctuation().
This commit is contained in:
parent
df74b5b234
commit
00f44ffbcb
|
@ -295,38 +295,39 @@ extension KeyHandler {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if composer.isEmpty {
|
guard composer.isEmpty else {
|
||||||
insertToCompositorAtCursor(reading: customPunctuation)
|
// 注音沒敲完的情況下,無視標點輸入。
|
||||||
let textToCommit = commitOverflownCompositionAndWalk
|
|
||||||
let inputting = buildInputtingState
|
|
||||||
inputting.textToCommit = textToCommit
|
|
||||||
stateCallback(inputting)
|
|
||||||
|
|
||||||
if mgrPrefs.useSCPCTypingMode, composer.isEmpty {
|
|
||||||
let candidateState = buildCandidate(
|
|
||||||
state: inputting,
|
|
||||||
isTypingVertical: isTypingVertical
|
|
||||||
)
|
|
||||||
if candidateState.candidates.count == 1 {
|
|
||||||
clear()
|
|
||||||
if let strtextToCommit: String = candidateState.candidates.first {
|
|
||||||
stateCallback(InputState.Committing(textToCommit: strtextToCommit) as InputState.Committing)
|
|
||||||
stateCallback(InputState.Empty())
|
|
||||||
} else {
|
|
||||||
stateCallback(candidateState)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
stateCallback(candidateState)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
} else {
|
|
||||||
// If there is still unfinished bpmf reading, ignore the punctuation
|
|
||||||
IME.prtDebugIntel("A9B69908D")
|
IME.prtDebugIntel("A9B69908D")
|
||||||
errorCallback()
|
errorCallback()
|
||||||
stateCallback(state)
|
stateCallback(state)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
insertToCompositorAtCursor(reading: customPunctuation)
|
||||||
|
let textToCommit = commitOverflownCompositionAndWalk
|
||||||
|
let inputting = buildInputtingState
|
||||||
|
inputting.textToCommit = textToCommit
|
||||||
|
stateCallback(inputting)
|
||||||
|
|
||||||
|
// 從這一行之後開始,就是針對逐字選字模式的單獨處理。
|
||||||
|
guard mgrPrefs.useSCPCTypingMode, composer.isEmpty else { return true }
|
||||||
|
|
||||||
|
let candidateState = buildCandidate(
|
||||||
|
state: inputting,
|
||||||
|
isTypingVertical: isTypingVertical
|
||||||
|
)
|
||||||
|
if candidateState.candidates.count == 1 {
|
||||||
|
clear()
|
||||||
|
if let strtextToCommit: String = candidateState.candidates.first {
|
||||||
|
stateCallback(InputState.Committing(textToCommit: strtextToCommit))
|
||||||
|
stateCallback(InputState.Empty())
|
||||||
|
} else {
|
||||||
|
stateCallback(candidateState)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
stateCallback(candidateState)
|
||||||
|
}
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Enter 鍵的處理
|
// MARK: - Enter 鍵的處理
|
||||||
|
|
Loading…
Reference in New Issue