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 42fe8b6abf
commit d14b61781e
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 // MARK: Enter
if (charCode == 13) { if (charCode == 13) {
if ([input isControlHold]) { 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]; return [self _handleEnterWithState:state stateCallback:stateCallback errorCallback:errorCallback];
} }

View File

@ -185,6 +185,12 @@ class ctlInputMethod: IMKInputController {
var textFrame = NSRect.zero var textFrame = NSRect.zero
let attributes: [AnyHashable: Any]? = (client as? IMKTextInput)?.attributes(forCharacterIndex: 0, lineHeightRectangle: &textFrame) let attributes: [AnyHashable: Any]? = (client as? IMKTextInput)?.attributes(forCharacterIndex: 0, lineHeightRectangle: &textFrame)
let useVerticalMode = (attributes?["IMKTextOrientation"] as? NSNumber)?.intValue == 0 || false 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 input = KeyHandlerInput(event: event, isVerticalMode: useVerticalMode)
@ -554,6 +560,12 @@ extension ctlInputMethod {
} }
} }
// MARK: -
@objc extension ctlInputMethod {
@objc static var areWeUsingOurOwnPhraseEditor: Bool = false
}
// MARK: - // MARK: -
extension ctlInputMethod: KeyHandlerDelegate { extension ctlInputMethod: KeyHandlerDelegate {