Skip to content

Commit

Permalink
fix Commend+X issue on Chrome and Safari
Browse files Browse the repository at this point in the history
  • Loading branch information
dongyuwei committed Feb 26, 2017
1 parent 34af2e5 commit 2300f73
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/InputController.m
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ -(BOOL)handleEvent:(NSEvent*)event client:(id)sender{
if (defaultEnglishMode){
break;
}

// ignore Command+X hotkeys.
if (modifiers & NSCommandKeyMask)
break;

handled = [self onKeyEvent:event client:sender];
break;
default:
Expand All @@ -69,11 +74,6 @@ -(BOOL)onKeyEvent:(NSEvent*)event client:(id)sender{
_currentClient = sender;
NSInteger keyCode = [event keyCode];
NSString* string = [event characters];
NSUInteger modifiers = [event modifierFlags];
if ([self shouldIgnoreKey:keyCode modifiers:modifiers]){
[self reset];
return NO;
}

if(keyCode == KEY_DELETE){
NSString* bufferedText = [self originalBuffer];
Expand Down Expand Up @@ -117,10 +117,6 @@ -(BOOL)onKeyEvent:(NSEvent*)event client:(id)sender{
return NO;
}

- (BOOL) shouldIgnoreKey:(NSInteger)keyCode modifiers:(NSUInteger)flags{
return (flags & NSCommandKeyMask);
}

- (BOOL)deleteBackward:(id)sender{
NSMutableString* originalText = [self originalBuffer];

Expand Down

0 comments on commit 2300f73

Please sign in to comment.