IME // Disable BPMF-Commit except typing into our user phrase editor.

- Otherwise, it may disturb user experiences in usual cases.
This commit is contained in:
ShikiSuen 2022-02-15 13:08:23 +08:00
parent 50f0d27209
commit ee31712cfe
2 changed files with 15 additions and 1 deletions

View File

@ -491,7 +491,9 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot";
// MARK: Enter
if (charCode == 13) {
if ([input isControlHold]) {
return [self _handleCtrlEnterWithState:state stateCallback:stateCallback errorCallback:errorCallback];
if (ctlInputMethod.areWeUsingOurOwnPhraseEditor) {
return [self _handleCtrlEnterWithState:state stateCallback:stateCallback errorCallback:errorCallback];
}
}
return [self _handleEnterWithState:state stateCallback:stateCallback errorCallback:errorCallback];
}

View File

@ -186,6 +186,12 @@ class ctlInputMethod: IMKInputController {
let attributes: [AnyHashable: Any]? = (client as? IMKTextInput)?.attributes(forCharacterIndex: 0, lineHeightRectangle: &textFrame)
let useVerticalMode = (attributes?["IMKTextOrientation"] as? NSNumber)?.intValue == 0 || false
if (client as? IMKTextInput)?.bundleIdentifier() == "org.atelierInmu.vChewing.vChewingPhraseEditor" {
ctlInputMethod.areWeUsingOurOwnPhraseEditor = true
} else {
ctlInputMethod.areWeUsingOurOwnPhraseEditor = false
}
let input = KeyHandlerInput(event: event, isVerticalMode: useVerticalMode)
let result = keyHandler.handle(input: input, state: state) { newState in
@ -554,6 +560,12 @@ extension ctlInputMethod {
}
}
// MARK: -
@objc extension ctlInputMethod {
@objc static var areWeUsingOurOwnPhraseEditor: Bool = false
}
// MARK: -
extension ctlInputMethod: KeyHandlerDelegate {