Skip to content

Instantly share code, notes, and snippets.

@spalger
Created April 14, 2015 16:53
Show Gist options
  • Save spalger/acd24fb970ae17a2a49d to your computer and use it in GitHub Desktop.
Save spalger/acd24fb970ae17a2a49d to your computer and use it in GitHub Desktop.
[d93a45a][2015-04-14] Spencer Alger: testing performKeyEquivalent
diff --git a/AppDelegate.m b/AppDelegate.m
index b8894c3..71212e2 100644
--- a/AppDelegate.m
+++ b/AppDelegate.m
@@ -178,6 +178,36 @@
}
}
+- (BOOL)webView:(WebView *)sender performKeyEquivalent:(NSEvent *)theEvent
+{
+ NSString * chars = [theEvent characters];
+ BOOL status = NO;
+
+ if ([theEvent modifierFlags] & NSCommandKeyMask){
+
+ if ([chars isEqualTo:@"a"]){
+ [sender selectAll:nil];
+ status = YES;
+ }
+
+ if ([chars isEqualTo:@"c"]){
+ [sender copy:nil];
+ status = YES;
+ }
+
+ if ([chars isEqualTo:@"v"]){
+ [sender paste:nil];
+ status = YES;
+ }
+
+ if ([chars isEqualTo:@"x"]){
+ [sender cut:nil];
+ status = YES;
+ }
+ }
+ return status;
+}
+
#pragma mark -
- (void)dealloc {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment