Merge pull request #37 from ShikiSuen/dev/PgUpDnKeyFunction
KeyHandler // PgUp & PgDn Support to Call Candidate Window.
This commit is contained in:
commit
c66200320e
|
@ -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
|
||||
|
@ -358,8 +359,10 @@ static NSString *const kGraphVizOutputfile = @"/tmp/vChewing-visualization.dot";
|
|||
// MARK: Space and Down
|
||||
// keyCode 125 = Down, charCode 32 = Space
|
||||
if (_bpmfReadingBuffer->isEmpty() &&
|
||||
[state isKindOfClass:[InputStateNotEmpty class]] &&
|
||||
([input isExtraChooseCandidateKey] || charCode == 32 || (input.useVerticalMode && ([input isVerticalModeOnlyChooseCandidateKey])))) {
|
||||
[state isKindOfClass:[InputStateNotEmpty class]] &&
|
||||
([input isExtraChooseCandidateKey] || charCode == 32
|
||||
|| [input isPageDown] || [input isPageUp]
|
||||
|| (input.useVerticalMode && ([input isVerticalModeOnlyChooseCandidateKey])))) {
|
||||
if (charCode == 32) {
|
||||
// if the spacebar is NOT set to be a selection key
|
||||
if ([input isShiftHold] || !Preferences.chooseCandidateUsingSpace) {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue