InputHandler // Extend upperCaseLetterKeyBehavior().

This commit is contained in:
ShikiSuen 2023-03-11 13:54:00 +08:00
parent c2ea8f254d
commit e4be1ecd3d
1 changed files with 15 additions and 11 deletions

View File

@ -255,22 +255,26 @@ extension InputHandler {
if input.isUpperCaseASCIILetterKey, !input.isCommandHold, !input.isControlHold { if input.isUpperCaseASCIILetterKey, !input.isCommandHold, !input.isControlHold {
if input.isShiftHold { // isOptionHold if input.isShiftHold { // isOptionHold
switch prefs.upperCaseLetterKeyBehavior { switch prefs.upperCaseLetterKeyBehavior {
case 1: case 1, 3:
delegate.switchState(IMEState.ofEmpty()) if prefs.upperCaseLetterKeyBehavior == 3, !isConsideredEmptyForNow { break }
delegate.switchState(IMEState.ofCommitting(textToCommit: inputText.lowercased())) let commitText = generateStateOfInputting(sansReading: true).displayedText
delegate.switchState(IMEState.ofCommitting(textToCommit: commitText + inputText.lowercased()))
return true return true
case 2: case 2, 4:
delegate.switchState(IMEState.ofEmpty()) if prefs.upperCaseLetterKeyBehavior == 4, !isConsideredEmptyForNow { break }
delegate.switchState(IMEState.ofCommitting(textToCommit: inputText.uppercased())) let commitText = generateStateOfInputting(sansReading: true).displayedText
delegate.switchState(IMEState.ofCommitting(textToCommit: commitText + inputText.uppercased()))
return true return true
default: // case 0 default: // case 0
break
}
//
let letter = "_letter_\(inputText)" let letter = "_letter_\(inputText)"
if handlePunctuation(letter) { if handlePunctuation(letter) {
return true return true
} }
} }
} }
}
// MARK: - (Still Nothing) // MARK: - (Still Nothing)