diff --git a/Source/Engine/ControllerModules/KeyHandler.mm b/Source/Engine/ControllerModules/KeyHandler.mm index fc3ba67e..515d1929 100644 --- a/Source/Engine/ControllerModules/KeyHandler.mm +++ b/Source/Engine/ControllerModules/KeyHandler.mm @@ -279,10 +279,11 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot"; } bool composeReading = false; + bool skipBpmfHandling = [input isReservedKey] || [input isControlHold]; // MARK: Handle BPMF Keys // see if it's valid BPMF reading - if (![input isControlHold] && _bpmfReadingBuffer->isValidKey((char) charCode)) { + if (!skipBpmfHandling && _bpmfReadingBuffer->isValidKey((char) charCode)) { _bpmfReadingBuffer->combineKey((char) charCode); // if we have a tone marker, we have to insert the reading to the diff --git a/Source/Engine/ControllerModules/KeyHandlerInput.swift b/Source/Engine/ControllerModules/KeyHandlerInput.swift index 131327b1..ea2390f5 100644 --- a/Source/Engine/ControllerModules/KeyHandlerInput.swift +++ b/Source/Engine/ControllerModules/KeyHandlerInput.swift @@ -72,6 +72,10 @@ class KeyHandlerInput: NSObject { super.init() } + override var description: String { + return "<\(super.description) inputText:\(String(describing: inputText)), charCode:\(charCode), keyCode:\(keyCode), flags:\(flags), cursorForwardKey:\(cursorForwardKey), cursorBackwardKey:\(cursorBackwardKey), extraChooseCandidateKey:\(extraChooseCandidateKey), absorbedArrowKey:\(absorbedArrowKey), verticalModeOnlyChooseCandidateKey:\(verticalModeOnlyChooseCandidateKey), emacsKey:\(emacsKey), useVerticalMode:\(useVerticalMode)>" + } + @objc var isShiftHold: Bool { flags.contains([.shift]) } @@ -100,6 +104,13 @@ class KeyHandlerInput: NSObject { flags.contains([.numericPad]) } + @objc var isReservedKey: Bool { + guard let code = KeyCode(rawValue: keyCode) else { + return false + } + return code.rawValue != KeyCode.none.rawValue + } + @objc var isEnter: Bool { KeyCode(rawValue: keyCode) == KeyCode.enter }