InputHandler // Implement Ctrl+Shift+Command+Enter feature.
This commit is contained in:
parent
5e49fe31ed
commit
bf4f3a22fb
|
@ -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 空格鍵設為選字窗呼叫用鍵的話………
|
||||||
// 空格字符輸入行為處理。
|
// 空格字符輸入行為處理。
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue