InputHandler // Again let Shift+Space commit FW space when ofEmpty().

This commit is contained in:
ShikiSuen 2022-10-29 17:58:22 +08:00
parent 47ab4867b1
commit 5ae6fc9841
1 changed files with 26 additions and 27 deletions

View File

@ -155,25 +155,34 @@ extension InputHandler {
: handleCtrlCommandEnter()) : handleCtrlCommandEnter())
: handleEnter() : handleEnter()
case .kSpace: // Space case .kSpace: // Space
// Tab Shift+Command+Space /
if input.isShiftHold { return rotateCandidate(reverseOrder: input.isCommandHold) }
// //
do { switch state.type {
if compositor.cursor < compositor.length, compositor.insertKey(" ") { case .ofEmpty:
walk() if !input.isOptionHold, !input.isControlHold, !input.isCommandHold {
// App delegate.switchState(IMEState.ofCommitting(textToCommit: input.isShiftHold ? " " : " "))
let textToCommit = commitOverflownComposition return true
var inputting = generateStateOfInputting()
inputting.textToCommit = textToCommit
delegate.switchState(inputting)
} else {
let displayedText = state.displayedText
if !displayedText.isEmpty {
delegate.switchState(IMEState.ofCommitting(textToCommit: displayedText))
} }
delegate.switchState(IMEState.ofCommitting(textToCommit: " ")) case .ofInputting:
} // Tab Shift+Command+Space /
return true if input.isShiftHold, !input.isControlHold, !input.isOptionHold {
return rotateCandidate(reverseOrder: input.isCommandHold)
}
if compositor.cursor < compositor.length, compositor.insertKey(" ") {
walk()
// App
let textToCommit = commitOverflownComposition
var inputting = generateStateOfInputting()
inputting.textToCommit = textToCommit
delegate.switchState(inputting)
} else {
let displayedText = state.displayedText
if !displayedText.isEmpty {
delegate.switchState(IMEState.ofCommitting(textToCommit: displayedText))
}
delegate.switchState(IMEState.ofCommitting(textToCommit: " "))
}
return true
default: break
} }
default: break default: break
} }
@ -234,16 +243,6 @@ extension InputHandler {
let punctuation: String = arrPunctuations.joined() let punctuation: String = arrPunctuations.joined()
if handlePunctuation(punctuation) { return true } if handlePunctuation(punctuation) { return true }
// MARK: / (Full-Width / Half-Width Space)
/// 使
if state.type == .ofEmpty {
if input.isSpace, !input.isOptionHold, !input.isControlHold, !input.isCommandHold {
delegate.switchState(IMEState.ofCommitting(textToCommit: input.isShiftHold ? " " : " "))
return true
}
}
// MARK: Shift+ (Shift+Letter Processing) // MARK: Shift+ (Shift+Letter Processing)
if input.isUpperCaseASCIILetterKey, !input.isCommandHold, !input.isControlHold { if input.isUpperCaseASCIILetterKey, !input.isCommandHold, !input.isControlHold {