diff --git a/Atom/Classes/AtomApp.m b/Atom/Classes/AtomApp.m index 7dcf49b0b..c7c79f6f9 100644 --- a/Atom/Classes/AtomApp.m +++ b/Atom/Classes/AtomApp.m @@ -50,21 +50,28 @@ // Overridden - (void)sendEvent:(NSEvent *)event { - if ([event type] == NSKeyDown) { - BOOL handeled = NO; - AtomController *controller = [[self keyWindow] windowController]; - - // The keyWindow could be a Cocoa Dialog or something, ignore those. - if ([controller isKindOfClass:[AtomController class]]) { + if ([event type] != NSKeyDown) { + [super sendEvent:event]; + return; + } + + BOOL handeled = NO; + AtomController *controller = [[self keyWindow] windowController]; + + // The keyWindow could be a Cocoa Dialog or something, ignore those. + if ([controller isKindOfClass:[AtomController class]]) { + // cmd-r should always reload the current controller, so it needs to be here + if ([event modifierFlags] & NSCommandKeyMask && [[event charactersIgnoringModifiers] hasPrefix:@"r"]) { + [self reloadController:controller]; + handeled = YES; + } + else { JSValueRef value = [controller.jscocoa callJSFunctionNamed:@"handleKeyEvent" withArguments:event, nil]; handeled = [controller.jscocoa toBool:value]; } - - if (!handeled) [super sendEvent:event]; - } - else { - [super sendEvent:event]; } + + if (!handeled) [super sendEvent:event]; } - (void)terminate:(id)sender { diff --git a/Atom/Classes/AtomController.m b/Atom/Classes/AtomController.m index 08932ce37..0768ceecb 100644 --- a/Atom/Classes/AtomController.m +++ b/Atom/Classes/AtomController.m @@ -49,10 +49,6 @@ [[webView mainFrame] loadRequest:request]; } -- (void)reload { - [(AtomApp *)NSApp reloadController:self]; -} - // WebUIDelegate - (NSArray *)webView:(WebView *)sender contextMenuItemsForElement:(NSDictionary *)element defaultMenuItems:(NSArray *)defaultMenuItems { return defaultMenuItems; diff --git a/src/atom/key-bindings.coffee b/src/atom/key-bindings.coffee index 7532497e5..3b11afd73 100644 --- a/src/atom/key-bindings.coffee +++ b/src/atom/key-bindings.coffee @@ -4,7 +4,6 @@ app: window: 'cmd-shift-I': (window) -> window.showConsole() - 'cmd-r': (window) -> window.reload() 'cmd-w': (window) -> window.close() 'cmd-o': (window) -> window.open() 'cmd-O': (window) -> window.open window.prompt "Open URL:" diff --git a/src/atom/window.coffee b/src/atom/window.coffee index d79bd6c4a..f4b240984 100644 --- a/src/atom/window.coffee +++ b/src/atom/window.coffee @@ -24,9 +24,6 @@ windowAdditions = setTitle: (title) -> $atomController.window.title = title - reload: -> - $atomController.reload - open: (url) -> url = atom.native.openPanel() unless url (@resource.open url) or atom.app.open url