Removes logs and add copyright information.
This commit is contained in:
parent
056ffeabfd
commit
dd803b6c31
|
@ -49,7 +49,6 @@
|
|||
D427F7B6279086F6004A2160 /* InputSourceHelper in Frameworks */ = {isa = PBXBuildFile; productRef = D427F7B5279086F6004A2160 /* InputSourceHelper */; };
|
||||
D427F7C127908EFC004A2160 /* OpenCCBridge in Frameworks */ = {isa = PBXBuildFile; productRef = D427F7C027908EFC004A2160 /* OpenCCBridge */; };
|
||||
D44FB74527915565003C80A6 /* Preferences.swift in Sources */ = {isa = PBXBuildFile; fileRef = D44FB74427915555003C80A6 /* Preferences.swift */; };
|
||||
D44FB74727919D35003C80A6 /* EmacsKeyHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = D44FB74627919C83003C80A6 /* EmacsKeyHelper.swift */; };
|
||||
D44FB74A2791B829003C80A6 /* VXHanConvert in Frameworks */ = {isa = PBXBuildFile; productRef = D44FB7492791B829003C80A6 /* VXHanConvert */; };
|
||||
D44FB74D2792189A003C80A6 /* PhraseReplacementMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D44FB74B2792189A003C80A6 /* PhraseReplacementMap.cpp */; };
|
||||
D456576E279E4F7B00DF6BC9 /* KeyHandlerInput.swift in Sources */ = {isa = PBXBuildFile; fileRef = D456576D279E4F7B00DF6BC9 /* KeyHandlerInput.swift */; };
|
||||
|
@ -202,7 +201,6 @@
|
|||
D427F7B2279086B5004A2160 /* InputSourceHelper */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = InputSourceHelper; path = Packages/InputSourceHelper; sourceTree = "<group>"; };
|
||||
D427F7BF27908EAC004A2160 /* OpenCCBridge */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = OpenCCBridge; path = Packages/OpenCCBridge; sourceTree = "<group>"; };
|
||||
D44FB74427915555003C80A6 /* Preferences.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Preferences.swift; sourceTree = "<group>"; };
|
||||
D44FB74627919C83003C80A6 /* EmacsKeyHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmacsKeyHelper.swift; sourceTree = "<group>"; };
|
||||
D44FB7482791B346003C80A6 /* VXHanConvert */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = VXHanConvert; path = Packages/VXHanConvert; sourceTree = "<group>"; };
|
||||
D44FB74B2792189A003C80A6 /* PhraseReplacementMap.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = PhraseReplacementMap.cpp; sourceTree = "<group>"; };
|
||||
D44FB74C2792189A003C80A6 /* PhraseReplacementMap.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PhraseReplacementMap.h; sourceTree = "<group>"; };
|
||||
|
@ -307,7 +305,6 @@
|
|||
D456576D279E4F7B00DF6BC9 /* KeyHandlerInput.swift */,
|
||||
D427F76B278CA1BA004A2160 /* AppDelegate.swift */,
|
||||
D44FB74427915555003C80A6 /* Preferences.swift */,
|
||||
D44FB74627919C83003C80A6 /* EmacsKeyHelper.swift */,
|
||||
D47F7DCF278C0897002F9DD7 /* NonModalAlertWindowController.swift */,
|
||||
D47F7DCD278BFB57002F9DD7 /* PreferencesWindowController.swift */,
|
||||
D47B92BF27972AC800458394 /* main.swift */,
|
||||
|
@ -704,7 +701,6 @@
|
|||
6ACC3D442793701600F1B140 /* ParselessPhraseDB.cpp in Sources */,
|
||||
D461B792279DAC010070E734 /* InputState.swift in Sources */,
|
||||
D47B92C027972AD100458394 /* main.swift in Sources */,
|
||||
D44FB74727919D35003C80A6 /* EmacsKeyHelper.swift in Sources */,
|
||||
D44FB74D2792189A003C80A6 /* PhraseReplacementMap.cpp in Sources */,
|
||||
D44FB74527915565003C80A6 /* Preferences.swift in Sources */,
|
||||
D47F7DD0278C0897002F9DD7 /* NonModalAlertWindowController.swift in Sources */,
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
// Copyright (c) 2022 and onwards The McBopomofo Authors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the "Software"), to deal in the Software without
|
||||
// restriction, including without limitation the rights to use,
|
||||
// copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following
|
||||
// conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
import Cocoa
|
||||
|
||||
@objc enum McBopomofoEmacsKey: UInt16 {
|
||||
case none = 0
|
||||
case forward = 6 // F
|
||||
case backward = 2 // B
|
||||
case home = 1 // A
|
||||
case end = 5 // E
|
||||
case delete = 4 // D
|
||||
case nextPage = 22 // V
|
||||
}
|
||||
|
||||
class EmacsKeyHelper: NSObject {
|
||||
@objc static func detect(charCode: UniChar, flags: NSEvent.ModifierFlags) -> McBopomofoEmacsKey {
|
||||
if flags.contains(.control) {
|
||||
return McBopomofoEmacsKey(rawValue: charCode) ?? .none
|
||||
}
|
||||
return .none;
|
||||
}
|
||||
}
|
|
@ -53,7 +53,6 @@
|
|||
candidateSelectionCallback:(void (^)(void))candidateSelectionCallback
|
||||
errorCallback:(void (^)(void))errorCallback;
|
||||
|
||||
- (void)handleState:(InputState *)newState
|
||||
client:(id)client;
|
||||
- (void)handleState:(InputState *)newState client:(id)client;
|
||||
|
||||
@end
|
||||
|
|
|
@ -239,9 +239,7 @@ static double FindHighestScore(const vector<NodeAnchor> &nodes, double epsilon)
|
|||
|
||||
_languageModel->setExternalConverterEnabled(Preferences.chineseConversionStyle == 1);
|
||||
|
||||
[(AppDelegate * )[
|
||||
NSApp
|
||||
delegate] checkForUpdate];
|
||||
[(AppDelegate * )[NSApp delegate] checkForUpdate];
|
||||
}
|
||||
|
||||
- (void)deactivateServer:(id)client
|
||||
|
@ -324,7 +322,7 @@ static double FindHighestScore(const vector<NodeAnchor> &nodes, double epsilon)
|
|||
|
||||
// if the composing buffer is empty and there's no reading, and there is some function key combination, we ignore it
|
||||
BOOL isFunctionKey = ([input isCommandHold] || [input isControlHold] || [input isOptionlHold] || [input isNumericPad]);
|
||||
if (![state isKindOfClass:[InputStateInputting class]] && isFunctionKey) {
|
||||
if (![state isKindOfClass:[InputStateNotEmpty class]] && isFunctionKey) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
@ -366,13 +364,11 @@ static double FindHighestScore(const vector<NodeAnchor> &nodes, double epsilon)
|
|||
|
||||
// MARK: Handle Candidates
|
||||
if ([state isKindOfClass:[InputStateChoosingCandidate class]]) {
|
||||
NSLog(@"Handle Candidates");
|
||||
return [self _handleCandidateState:(InputStateChoosingCandidate *) state input:input stateCallback:stateCallback candidateSelectionCallback:candidateSelectionCallback errorCallback:errorCallback];
|
||||
}
|
||||
|
||||
// MARK: Handle Marking
|
||||
if ([state isKindOfClass:[InputStateMarking class]]) {
|
||||
NSLog(@"Handle Marking");
|
||||
InputStateMarking *marking = (InputStateMarking *)state;
|
||||
if ([self _handleMarkingState:(InputStateMarking *)state input:input stateCallback:stateCallback candidateSelectionCallback:candidateSelectionCallback errorCallback:errorCallback]) {
|
||||
return YES;
|
||||
|
@ -850,21 +846,14 @@ static double FindHighestScore(const vector<NodeAnchor> &nodes, double epsilon)
|
|||
return YES;
|
||||
}
|
||||
|
||||
NSLog(@"Test 3");
|
||||
|
||||
// Shift + left
|
||||
if (([input isCursorBackward]
|
||||
// || input.emacsKey == McBopomofoEmacsKeyBackward
|
||||
)
|
||||
if (([input isCursorBackward] || input.emacsKey == McBopomofoEmacsKeyBackward)
|
||||
&& ([input isShiftHold])) {
|
||||
NSLog(@"Shift + left");
|
||||
stateCallback(state);
|
||||
NSUInteger index = state.markerIndex;
|
||||
if (index > 0) {
|
||||
index -= 1;
|
||||
InputStateMarking *marking = [[InputStateMarking alloc] initWithComposingBuffer:state.composingBuffer cursorIndex:state.cursorIndex markerIndex:index];
|
||||
marking.readings = state.readings;
|
||||
NSLog(@"cursorBackwardKey %@", marking);
|
||||
stateCallback(marking);
|
||||
} else {
|
||||
errorCallback();
|
||||
|
@ -873,21 +862,14 @@ static double FindHighestScore(const vector<NodeAnchor> &nodes, double epsilon)
|
|||
return YES;
|
||||
}
|
||||
|
||||
NSLog(@"Test 4");
|
||||
|
||||
// Shift + Right
|
||||
if (([input isCursorBackward]
|
||||
// || input.emacsKey == McBopomofoEmacsKeyForward
|
||||
)
|
||||
if (([input isCursorForward] || input.emacsKey == McBopomofoEmacsKeyForward)
|
||||
&& ([input isShiftHold])) {
|
||||
NSLog(@"Shift + Right");
|
||||
stateCallback(state);
|
||||
NSUInteger index = state.markerIndex;
|
||||
if (index < state.composingBuffer.length) {
|
||||
index += 1;
|
||||
InputStateMarking *marking = [[InputStateMarking alloc] initWithComposingBuffer:state.composingBuffer cursorIndex:state.cursorIndex markerIndex:index];
|
||||
marking.readings = state.readings;
|
||||
NSLog(@"cursorForwardKey %@", marking);
|
||||
stateCallback(marking);
|
||||
} else {
|
||||
errorCallback();
|
||||
|
@ -895,8 +877,6 @@ static double FindHighestScore(const vector<NodeAnchor> &nodes, double epsilon)
|
|||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
NSLog(@"_handleMarkingState 5");
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
@ -923,24 +903,32 @@ static double FindHighestScore(const vector<NodeAnchor> &nodes, double epsilon)
|
|||
InputState *inputting = [self _buildInputtingState];
|
||||
stateCallback(inputting);
|
||||
return YES;
|
||||
} else if (charCode == 13 || [input isEnter]) {
|
||||
}
|
||||
|
||||
if (charCode == 13 || [input isEnter]) {
|
||||
[self candidateController:gCurrentCandidateController didSelectCandidateAtIndex:gCurrentCandidateController.selectedCandidateIndex];
|
||||
return YES;
|
||||
} else if (charCode == 32 || [input isPageDown] || input.emacsKey == McBopomofoEmacsKeyNextPage) {
|
||||
}
|
||||
|
||||
if (charCode == 32 || [input isPageDown] || input.emacsKey == McBopomofoEmacsKeyNextPage) {
|
||||
BOOL updated = [gCurrentCandidateController showNextPage];
|
||||
if (!updated) {
|
||||
errorCallback();
|
||||
}
|
||||
candidateSelectionCallback();
|
||||
return YES;
|
||||
} else if ([input isPageUp]) {
|
||||
}
|
||||
|
||||
if ([input isPageUp]) {
|
||||
BOOL updated = [gCurrentCandidateController showPreviousPage];
|
||||
if (!updated) {
|
||||
errorCallback();
|
||||
}
|
||||
candidateSelectionCallback();
|
||||
return YES;
|
||||
} else if ([input isLeft]) {
|
||||
}
|
||||
|
||||
if ([input isLeft]) {
|
||||
if ([gCurrentCandidateController isKindOfClass:[VTHorizontalCandidateController class]]) {
|
||||
BOOL updated = [gCurrentCandidateController highlightPreviousCandidate];
|
||||
if (!updated) {
|
||||
|
@ -954,14 +942,18 @@ static double FindHighestScore(const vector<NodeAnchor> &nodes, double epsilon)
|
|||
}
|
||||
candidateSelectionCallback();
|
||||
return YES;
|
||||
} else if (input.emacsKey == McBopomofoEmacsKeyBackward) {
|
||||
}
|
||||
|
||||
if (input.emacsKey == McBopomofoEmacsKeyBackward) {
|
||||
BOOL updated = [gCurrentCandidateController highlightPreviousCandidate];
|
||||
if (!updated) {
|
||||
errorCallback();
|
||||
}
|
||||
candidateSelectionCallback();
|
||||
return YES;
|
||||
} else if ([input isRight]) {
|
||||
}
|
||||
|
||||
if ([input isRight]) {
|
||||
if ([gCurrentCandidateController isKindOfClass:[VTHorizontalCandidateController class]]) {
|
||||
BOOL updated = [gCurrentCandidateController highlightNextCandidate];
|
||||
if (!updated) {
|
||||
|
@ -975,14 +967,18 @@ static double FindHighestScore(const vector<NodeAnchor> &nodes, double epsilon)
|
|||
}
|
||||
candidateSelectionCallback();
|
||||
return YES;
|
||||
} else if (input.emacsKey == McBopomofoEmacsKeyForward) {
|
||||
}
|
||||
|
||||
if (input.emacsKey == McBopomofoEmacsKeyForward) {
|
||||
BOOL updated = [gCurrentCandidateController highlightNextCandidate];
|
||||
if (!updated) {
|
||||
errorCallback();
|
||||
}
|
||||
candidateSelectionCallback();
|
||||
return YES;
|
||||
} else if ([input isUp]) {
|
||||
}
|
||||
|
||||
if ([input isUp]) {
|
||||
if ([gCurrentCandidateController isKindOfClass:[VTHorizontalCandidateController class]]) {
|
||||
BOOL updated = [gCurrentCandidateController showPreviousPage];
|
||||
if (!updated) {
|
||||
|
@ -996,7 +992,9 @@ static double FindHighestScore(const vector<NodeAnchor> &nodes, double epsilon)
|
|||
}
|
||||
candidateSelectionCallback();
|
||||
return YES;
|
||||
} else if ([input isDown]) {
|
||||
}
|
||||
|
||||
if ([input isDown]) {
|
||||
if ([gCurrentCandidateController isKindOfClass:[VTHorizontalCandidateController class]]) {
|
||||
BOOL updated = [gCurrentCandidateController showNextPage];
|
||||
if (!updated) {
|
||||
|
@ -1010,7 +1008,9 @@ static double FindHighestScore(const vector<NodeAnchor> &nodes, double epsilon)
|
|||
}
|
||||
candidateSelectionCallback();
|
||||
return YES;
|
||||
} else if ([input isHome] || input.emacsKey == McBopomofoEmacsKeyHome) {
|
||||
}
|
||||
|
||||
if ([input isHome] || input.emacsKey == McBopomofoEmacsKeyHome) {
|
||||
if (gCurrentCandidateController.selectedCandidateIndex == 0) {
|
||||
errorCallback();
|
||||
} else {
|
||||
|
@ -1019,7 +1019,9 @@ static double FindHighestScore(const vector<NodeAnchor> &nodes, double epsilon)
|
|||
|
||||
candidateSelectionCallback();
|
||||
return YES;
|
||||
} else if (([input isEnd] || input.emacsKey == McBopomofoEmacsKeyEnd) && [state.candidates count] > 0) {
|
||||
}
|
||||
|
||||
if (([input isEnd] || input.emacsKey == McBopomofoEmacsKeyEnd) && [state.candidates count] > 0) {
|
||||
if (gCurrentCandidateController.selectedCandidateIndex == [state.candidates count] - 1) {
|
||||
errorCallback();
|
||||
} else {
|
||||
|
@ -1117,6 +1119,7 @@ static double FindHighestScore(const vector<NodeAnchor> &nodes, double epsilon)
|
|||
BOOL result = [self handleInput:input state:_state stateCallback:^(InputState *state) {
|
||||
[self handleState:state client:client];
|
||||
} candidateSelectionCallback:^{
|
||||
NSLog(@"candidateSelectionCallback ");
|
||||
// [self handleState:self->_state client:(self->_currentCandidateClient ? self->_currentCandidateClient : client)];
|
||||
} errorCallback:^{
|
||||
NSBeep();
|
||||
|
|
|
@ -1,3 +1,26 @@
|
|||
// Copyright (c) 2022 and onwards The McBopomofo Authors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the "Software"), to deal in the Software without
|
||||
// restriction, including without limitation the rights to use,
|
||||
// copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following
|
||||
// conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
import Cocoa
|
||||
|
||||
/// Represents the states for the input controller.
|
||||
|
|
|
@ -1,6 +1,29 @@
|
|||
// Copyright (c) 2022 and onwards The McBopomofo Authors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person
|
||||
// obtaining a copy of this software and associated documentation
|
||||
// files (the "Software"), to deal in the Software without
|
||||
// restriction, including without limitation the rights to use,
|
||||
// copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the
|
||||
// Software is furnished to do so, subject to the following
|
||||
// conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
// OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
import Cocoa
|
||||
|
||||
@objc enum KeyCode: Int {
|
||||
enum KeyCode: UInt16 {
|
||||
case none = 0
|
||||
case enter = 76
|
||||
case up = 126
|
||||
|
@ -18,18 +41,18 @@ import Cocoa
|
|||
@objc private (set) var useVerticalMode: Bool
|
||||
@objc private (set) var inputText: String?
|
||||
@objc private (set) var charCode: UInt16
|
||||
@objc private var keyCode: Int
|
||||
@objc private var flags: NSEvent.ModifierFlags
|
||||
@objc private var cursorForwardKey: KeyCode
|
||||
@objc private var cursorBackwardKey: KeyCode
|
||||
@objc private var extraChooseCandidateKey: KeyCode
|
||||
@objc private var absorbedArrowKey: KeyCode
|
||||
@objc private var verticalModeOnlyChooseCandidateKey: KeyCode
|
||||
private var keyCode: UInt16
|
||||
private var flags: NSEvent.ModifierFlags
|
||||
private var cursorForwardKey: KeyCode
|
||||
private var cursorBackwardKey: KeyCode
|
||||
private var extraChooseCandidateKey: KeyCode
|
||||
private var absorbedArrowKey: KeyCode
|
||||
private var verticalModeOnlyChooseCandidateKey: KeyCode
|
||||
@objc private (set) var emacsKey: McBopomofoEmacsKey
|
||||
|
||||
@objc init(inputText: String?, keyCode: UInt16, charCode: UInt16, flags: NSEvent.ModifierFlags, isVerticalMode: Bool) {
|
||||
self.inputText = inputText
|
||||
self.keyCode = Int(keyCode)
|
||||
self.keyCode = keyCode
|
||||
self.charCode = charCode
|
||||
self.flags = flags
|
||||
self.useVerticalMode = isVerticalMode
|
||||
|
@ -44,7 +67,7 @@ import Cocoa
|
|||
|
||||
@objc init(event: NSEvent, isVerticalMode: Bool) {
|
||||
self.inputText = event.characters
|
||||
self.keyCode = Int(event.keyCode)
|
||||
self.keyCode = event.keyCode
|
||||
self.flags = event.modifierFlags
|
||||
self.useVerticalMode = isVerticalMode
|
||||
let charCode: UInt16 = {
|
||||
|
@ -62,6 +85,7 @@ import Cocoa
|
|||
self.absorbedArrowKey = useVerticalMode ? .right : .up
|
||||
self.verticalModeOnlyChooseCandidateKey = useVerticalMode ? absorbedArrowKey : .none
|
||||
super.init()
|
||||
NSLog("self.keyCode \(self.keyCode)")
|
||||
}
|
||||
|
||||
@objc var isShiftHold: Bool {
|
||||
|
@ -150,3 +174,21 @@ import Cocoa
|
|||
|
||||
}
|
||||
|
||||
@objc enum McBopomofoEmacsKey: UInt16 {
|
||||
case none = 0
|
||||
case forward = 6 // F
|
||||
case backward = 2 // B
|
||||
case home = 1 // A
|
||||
case end = 5 // E
|
||||
case delete = 4 // D
|
||||
case nextPage = 22 // V
|
||||
}
|
||||
|
||||
class EmacsKeyHelper: NSObject {
|
||||
@objc static func detect(charCode: UniChar, flags: NSEvent.ModifierFlags) -> McBopomofoEmacsKey {
|
||||
if flags.contains(.control) {
|
||||
return McBopomofoEmacsKey(rawValue: charCode) ?? .none
|
||||
}
|
||||
return .none;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue