diff --git a/keymaps/base.cson b/keymaps/base.cson index 976db68d8..938a4ee0d 100644 --- a/keymaps/base.cson +++ b/keymaps/base.cson @@ -23,11 +23,11 @@ 'cmdctrl-z': 'core:undo' 'cmdctrl-Z': 'core:redo' 'cmdctrl-y': 'core:redo' + 'shift-delete': 'core:cut' 'cmdctrl-x': 'core:cut' 'cmdctrl-c': 'core:copy' 'cmdctrl-v': 'core:paste' 'cmdctrl-a': 'core:select-all' - 'shift-delete': 'core:cut' 'up' : 'core:previous-item' 'down' : 'core:next-item' diff --git a/keymaps/templates/Outlook.cson b/keymaps/templates/Outlook.cson index ce6d4c409..ddce21b1e 100644 --- a/keymaps/templates/Outlook.cson +++ b/keymaps/templates/Outlook.cson @@ -4,13 +4,13 @@ 'body': # Windows email-specific menu items 'cmdctrl-shift-v': 'application:change-category' # Outlook - 'F3': 'application:focus-search' + 'F3': 'application:focus-search' 'cmdctrl-e': 'application:focus-search' 'cmdctrl-f': 'application:forward' 'cmdctrl-shift-v': 'application:change-category' 'cmdctrl-d': 'application:delete-item' - 'alt-backspace':'core:undo' - 'alt-s': 'application:send-message' + 'alt-backspace': 'core:undo' + 'alt-s': 'application:send-message' 'cmdctrl-r': 'application:reply' 'cmdctrl-shift-r': 'application:reply-all' 'cmdctrl-n' : 'application:new-message' diff --git a/src/browser/application.coffee b/src/browser/application.coffee index 831dbf83f..610c1767c 100644 --- a/src/browser/application.coffee +++ b/src/browser/application.coffee @@ -415,23 +415,19 @@ class Application sendCommand: (command, args...) -> unless @emit(command, args...) focusedWindow = @windowManager.focusedWindow() - focusedBrowserWindow = BrowserWindow.getFocusedWindow() - mainWindow = @windowManager.mainWindow() - - if focusedWindow? + if focusedWindow focusedWindow.sendCommand(command, args...) - else if focusedBrowserWindow? - # Note: We sometimes display non-"AtomWindow" windows, for things like - # raw message contents. Ensure that these also get to run window commands - unless @sendCommandToFirstResponder(command) - switch command - when 'window:reload' then focusedBrowserWindow.reload() - when 'window:toggle-dev-tools' then focusedBrowserWindow.toggleDevTools() - when 'window:close' then focusedBrowserWindow.close() - else if mainWindow? - mainWindow.sendCommand(command, args...) else - @sendCommandToFirstResponder(command) + unless @sendCommandToFirstResponder(command) + focusedBrowserWindow = BrowserWindow.getFocusedWindow() + mainWindow = @windowManager.mainWindow() + if focusedBrowserWindow + switch command + when 'window:reload' then focusedBrowserWindow.reload() + when 'window:toggle-dev-tools' then focusedBrowserWindow.toggleDevTools() + when 'window:close' then focusedBrowserWindow.close() + else if mainWindow + mainWindow.sendCommand(command, args...) # Public: Executes the given command on the given window. # diff --git a/src/keymap-utils.coffee b/src/keymap-utils.coffee index a503a56fc..92e197ec3 100644 --- a/src/keymap-utils.coffee +++ b/src/keymap-utils.coffee @@ -1,20 +1,16 @@ KeymapUtils = cmdCtrlPreprocessor: (keymap={}) -> re = /(cmdctrl|ctrlcmd)/i + if process.platform is "darwin" + cmdctrl = 'cmd' + else + cmdctrl = 'ctrl' + for selector, keyBindings of keymap normalizedBindings = {} for keystrokes, command of keyBindings - if re.test keystrokes - if process.platform is "darwin" - newKeystrokes1= keystrokes.replace(re, "ctrl") - newKeystrokes2= keystrokes.replace(re, "cmd") - normalizedBindings[newKeystrokes1] = command - normalizedBindings[newKeystrokes2] = command - else - newKeystrokes = keystrokes.replace(re, "ctrl") - normalizedBindings[newKeystrokes] = command - else - normalizedBindings[keystrokes] = command + keystrokes = keystrokes.replace(re, cmdctrl) + normalizedBindings[keystrokes] = command keymap[selector] = normalizedBindings return keymap diff --git a/src/menu-manager.coffee b/src/menu-manager.coffee index 91ed99a01..dc3f7c9f8 100644 --- a/src/menu-manager.coffee +++ b/src/menu-manager.coffee @@ -64,6 +64,7 @@ class MenuManager @pendingUpdateOperation = null @template = [] atom.keymaps.onDidLoadBundledKeymaps => @loadPlatformItems() + atom.keymaps.onDidReloadKeymap => @update() atom.packages.onDidActivateInitialPackages => @sortPackagesMenu() # Public: Adds the given items to the application menu. @@ -165,7 +166,7 @@ class MenuManager for key, bindings of keystrokesByCommand for binding in bindings continue if binding.indexOf(' ') != -1 - + continue unless /(cmd|ctrl|shift|alt)/.test(binding) filtered[key] ?= [] filtered[key].push(binding) filtered