diff --git a/src/brackets.js b/src/brackets.js index f48c2bd11aa..d5025d9878e 100644 --- a/src/brackets.js +++ b/src/brackets.js @@ -172,8 +172,6 @@ define(function (require, exports, module) { {"Shift-F3": Commands.EDIT_FIND_PREVIOUS, "platform": "win"}, {"Ctrl-Alt-F": Commands.EDIT_REPLACE, "platform": "mac"}, {"Ctrl-H": Commands.EDIT_REPLACE, "platform": "win"}, - {"Ctrl-Tab": Commands.EDIT_INDENT}, - {"Ctrl-Shift-Tab": Commands.EDIT_UNINDENT}, // VIEW {"Ctrl-Shift-H": Commands.VIEW_HIDE_SIDEBAR}, diff --git a/src/command/KeyMap.js b/src/command/KeyMap.js index 955fe247ed7..8a83a2fe53b 100644 --- a/src/command/KeyMap.js +++ b/src/command/KeyMap.js @@ -204,6 +204,9 @@ define(function (require, exports, module) { } } + // Translate some keys to their common names } + if (key === "\t") { key = "Tab"; } + return _buildKeyDescriptor(hasCtrl, hasAlt, hasShift, key); } diff --git a/src/command/Menus.js b/src/command/Menus.js index 93b4211935c..0e0eed5a723 100644 --- a/src/command/Menus.js +++ b/src/command/Menus.js @@ -41,7 +41,6 @@ define(function (require, exports, module) { "menu-edit-find-next": Commands.EDIT_FIND_NEXT, "menu-edit-find-previous": Commands.EDIT_FIND_PREVIOUS, "menu-edit-replace": Commands.EDIT_REPLACE, - // View "menu-view-hide-sidebar": Commands.VIEW_HIDE_SIDEBAR, @@ -69,10 +68,8 @@ define(function (require, exports, module) { function createExecFunc(commandStr) { return function () { - // TODO TY: should flash menu here + // TODO TY: should flash menu here on Mac //console.log(commandStr); - - EditorManager.focusEditor(); CommandManager.execute(commandStr); }; } @@ -106,11 +103,22 @@ define(function (require, exports, module) { shortcut = keyCmd.replace(/-/g, "+"); } - $("#" + menuID).append("" + shortcut + ""); + var $menu = $("#" + menuID); + // Some commands have multiple key commands. Only add the first one. + if ($menu.find(".menu-shortcut").length === 0) { + $menu.append("" + shortcut + ""); + } } } } + // Prevent clicks on the top-level menu bar from taking focus + // Note, bootstrap handles this already for the menu drop downs + $("#main-toolbar .dropdown").mousedown(function (e) { + e.preventDefault(); + }); + + // Other debug menu items // $("#menu-debug-wordwrap").click(function() { diff --git a/src/editor/Editor.js b/src/editor/Editor.js index 91ba38a64b2..7b07919f936 100644 --- a/src/editor/Editor.js +++ b/src/editor/Editor.js @@ -47,8 +47,6 @@ define(function (require, exports, module) { TextRange = require("document/TextRange").TextRange, ViewUtils = require("utils/ViewUtils"); - - /** * @private @@ -191,7 +189,7 @@ define(function (require, exports, module) { function _handleSelectAll() { var editor = EditorManager.getFocusedEditor(); if (editor) { - editor._codeMirror.execCommand("selectAll"); + editor._selectAllVisible(); } } @@ -294,6 +292,7 @@ define(function (require, exports, module) { // Editor supplies some standard keyboard behavior extensions of its own var codeMirrorKeyMap = { "Tab" : _handleTabKey, + "Left" : function (instance) { if (!_handleSoftTabNavigation(instance, -1, "moveH")) { CodeMirror.commands.goCharLeft(instance); @@ -971,10 +970,6 @@ define(function (require, exports, module) { CommandManager.register(Commands.EDIT_FIND_PREVIOUS, _findPrevious); CommandManager.register(Commands.EDIT_SELECT_ALL, _handleSelectAll); - // TODO: code mirror handles - // CommandManager.register(Commands.EDIT_INDENT, _handleTabKey); - // CommandManager.register(Commands.EDIT_UNINDENT, _handleTabKey); - // Define public API exports.Editor = Editor; }); diff --git a/src/index.html b/src/index.html index 1ff365fd550..602d4184626 100644 --- a/src/index.html +++ b/src/index.html @@ -98,9 +98,6 @@
  • Find Previous

  • Replace
  • -

  • -
  • Indent
  • -
  • Unindent