Merge pull request #253 from oeway/master

Make Command key on Mac works as Ctrl key
This commit is contained in:
Thomas Wilburn 2014-06-24 08:21:56 -07:00
commit 2687b6c3c0
2 changed files with 6 additions and 1 deletions

View file

@ -7,6 +7,8 @@
"Ctrl-N": "session:new-file",
"Ctrl-Tab": "session:change-tab",
"Ctrl-Shift-Tab": { "command": "session:change-tab", "argument": -1 },
"Ctrl-Z": {"command": "ace:command", "argument": "undo" },
"Ctrl-Shift-Z": { "command": "ace:command", "argument": "redo" },
//Chromebook fixes
"Ctrl-Up": { "ace": "addCursorAbove" },

View file

@ -31,7 +31,8 @@ define([
var defaultAceCommands = ace.require("./commands/default_commands").commands;
var AceCommandManager = ace.require("./commands/command_manager").CommandManager;
var vimHandler = ace.require("ace/keyboard/vim").handler;
var useragent = ace.require("ace/lib/useragent");
//back-compat: we now use Ace-style bindings (Ctrl-X) instead of Vim-style (^-x)
var normalizeKeys = function(config) {
var converted = {};
@ -86,6 +87,8 @@ define([
char = keycodes[e.keyCode];
}
var prefixes = [];
//Make Command key on Mac works as Ctrl key
if (useragent.isMac && e.metaKey) prefixes.push("Ctrl");
if (e.ctrlKey) prefixes.push("Ctrl");
if (e.altKey) prefixes.push("Alt");
if (e.shiftKey) prefixes.push("Shift");