adding command key to emacs keyhandler.

usage:
keyHandler.bindKey("CMD-g": "someNewCommand")
This commit is contained in:
Robert Krahn 2013-02-19 15:20:11 -08:00
commit 9fd93a5e37

View file

@ -134,13 +134,15 @@ var $resetMarkMode = function(e) {
e.editor.session.$emacsMark = null; e.editor.session.$emacsMark = null;
} }
var keys = require("../lib/keys").KEY_MODS; var keys = require("../lib/keys").KEY_MODS,
var eMods = { eMods = {C: "ctrl", S: "shift", M: "alt", CMD: "command"},
C: "ctrl", S: "shift", M: "alt" combinations = ["C-S-M-CMD",
}; "S-M-CMD", "C-M-CMD", "C-S-CMD", "C-S-M",
["S-C-M", "S-C", "S-M", "C-M", "S", "C", "M"].forEach(function(c) { "M-CMD", "S-CMD", "S-M", "C-CMD", "C-M", "C-S",
"CMD", "M", "S", "C"];
combinations.forEach(function(c) {
var hashId = 0; var hashId = 0;
c.split("-").forEach(function(c){ c.split("-").forEach(function(c) {
hashId = hashId | keys[eMods[c]]; hashId = hashId | keys[eMods[c]];
}); });
eMods[hashId] = c.toLowerCase() + "-"; eMods[hashId] = c.toLowerCase() + "-";