KeyHandler // Remove errorCallback from certain handles.

This commit is contained in:
ShikiSuen 2022-07-01 09:01:58 +08:00
parent d4d9295482
commit 3d9af406cb
2 changed files with 9 additions and 13 deletions

View File

@ -303,7 +303,7 @@ extension KeyHandler {
// MARK: Esc
if input.isEsc { return handleEsc(state: state, stateCallback: stateCallback, errorCallback: errorCallback) }
if input.isEsc { return handleEsc(state: state, stateCallback: stateCallback) }
// MARK: Tab
@ -379,9 +379,9 @@ extension KeyHandler {
if input.isEnter {
return (input.isCommandHold && input.isControlHold)
? (input.isOptionHold
? handleCtrlOptionCommandEnter(state: state, stateCallback: stateCallback, errorCallback: errorCallback)
: handleCtrlCommandEnter(state: state, stateCallback: stateCallback, errorCallback: errorCallback))
: handleEnter(state: state, stateCallback: stateCallback, errorCallback: errorCallback)
? handleCtrlOptionCommandEnter(state: state, stateCallback: stateCallback)
: handleCtrlCommandEnter(state: state, stateCallback: stateCallback))
: handleEnter(state: state, stateCallback: stateCallback)
}
// MARK: -
@ -408,7 +408,7 @@ extension KeyHandler {
// commit buffer ESC
// Enter 使 commit buffer
// bool _ =
_ = handleEnter(state: state, stateCallback: stateCallback, errorCallback: errorCallback)
_ = handleEnter(state: state, stateCallback: stateCallback)
stateCallback(InputState.SymbolTable(node: SymbolNode.root, isTypingVertical: input.isTypingVertical))
return true
}

View File

@ -339,8 +339,7 @@ extension KeyHandler {
/// - Returns: ctlInputMethod IMK
func handleEnter(
state: InputStateProtocol,
stateCallback: @escaping (InputStateProtocol) -> Void,
errorCallback _: @escaping () -> Void
stateCallback: @escaping (InputStateProtocol) -> Void
) -> Bool {
guard let currentState = state as? InputState.Inputting else { return false }
@ -359,8 +358,7 @@ extension KeyHandler {
/// - Returns: ctlInputMethod IMK
func handleCtrlCommandEnter(
state: InputStateProtocol,
stateCallback: @escaping (InputStateProtocol) -> Void,
errorCallback _: @escaping () -> Void
stateCallback: @escaping (InputStateProtocol) -> Void
) -> Bool {
guard state is InputState.Inputting else { return false }
@ -390,8 +388,7 @@ extension KeyHandler {
/// - Returns: ctlInputMethod IMK
func handleCtrlOptionCommandEnter(
state: InputStateProtocol,
stateCallback: @escaping (InputStateProtocol) -> Void,
errorCallback _: @escaping () -> Void
stateCallback: @escaping (InputStateProtocol) -> Void
) -> Bool {
guard state is InputState.Inputting else { return false }
@ -594,8 +591,7 @@ extension KeyHandler {
/// - Returns: ctlInputMethod IMK
func handleEsc(
state: InputStateProtocol,
stateCallback: @escaping (InputStateProtocol) -> Void,
errorCallback _: @escaping () -> Void
stateCallback: @escaping (InputStateProtocol) -> Void
) -> Bool {
guard state is InputState.Inputting else { return false }