InputHandler // Implement Ctrl+Shift+Command+Enter feature.

This commit is contained in:
ShikiSuen 2022-12-04 15:54:21 +08:00
parent 5e49fe31ed
commit bf4f3a22fb
2 changed files with 3 additions and 4 deletions

View File

@ -150,7 +150,7 @@ extension InputHandler {
return (input.isCommandHold && input.isControlHold) return (input.isCommandHold && input.isControlHold)
? (input.isOptionHold ? (input.isOptionHold
? handleCtrlOptionCommandEnter() ? handleCtrlOptionCommandEnter()
: handleCtrlCommandEnter()) : handleCtrlCommandEnter(isShiftPressed: input.isShiftHold))
: handleEnter() : handleEnter()
case .kSpace: // Space case .kSpace: // Space
// //

View File

@ -296,7 +296,7 @@ extension InputHandler {
/// Command+Enter /// Command+Enter
/// - Returns: SessionCtl IMK /// - Returns: SessionCtl IMK
func handleCtrlCommandEnter() -> Bool { func handleCtrlCommandEnter(isShiftPressed: Bool = false) -> Bool {
guard let delegate = delegate else { return false } guard let delegate = delegate else { return false }
let state = delegate.state let state = delegate.state
guard state.type == .ofInputting else { return false } guard state.type == .ofInputting else { return false }
@ -319,8 +319,7 @@ extension InputHandler {
} }
} }
let isVCED = delegate.clientBundleIdentifier.contains("vChewingPhraseEditor") displayedText = displayedText.replacingOccurrences(of: "\t", with: isShiftPressed ? "-" : " ")
displayedText = displayedText.replacingOccurrences(of: "\t", with: isVCED ? "-" : " ")
delegate.switchState(IMEState.ofCommitting(textToCommit: displayedText)) delegate.switchState(IMEState.ofCommitting(textToCommit: displayedText))
return true return true