Zonble: KeyHandler // Stop misidentifying reserved keys as bpmf keys.
This commit is contained in:
parent
5465deba7c
commit
3cdc748663
|
@ -279,10 +279,11 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool composeReading = false;
|
bool composeReading = false;
|
||||||
|
bool skipBpmfHandling = [input isReservedKey] || [input isControlHold];
|
||||||
|
|
||||||
// MARK: Handle BPMF Keys
|
// MARK: Handle BPMF Keys
|
||||||
// see if it's valid BPMF reading
|
// see if it's valid BPMF reading
|
||||||
if (![input isControlHold] && _bpmfReadingBuffer->isValidKey((char) charCode)) {
|
if (!skipBpmfHandling && _bpmfReadingBuffer->isValidKey((char) charCode)) {
|
||||||
_bpmfReadingBuffer->combineKey((char) charCode);
|
_bpmfReadingBuffer->combineKey((char) charCode);
|
||||||
|
|
||||||
// if we have a tone marker, we have to insert the reading to the
|
// if we have a tone marker, we have to insert the reading to the
|
||||||
|
|
|
@ -72,6 +72,10 @@ class KeyHandlerInput: NSObject {
|
||||||
super.init()
|
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 {
|
@objc var isShiftHold: Bool {
|
||||||
flags.contains([.shift])
|
flags.contains([.shift])
|
||||||
}
|
}
|
||||||
|
@ -100,6 +104,13 @@ class KeyHandlerInput: NSObject {
|
||||||
flags.contains([.numericPad])
|
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 {
|
@objc var isEnter: Bool {
|
||||||
KeyCode(rawValue: keyCode) == KeyCode.enter
|
KeyCode(rawValue: keyCode) == KeyCode.enter
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue