Merge pull request #1626 from thomaswilburn/master
Rename "commmandKeyBinding" to have 33% less "m"
This commit is contained in:
commit
cc2f80f8c1
4 changed files with 10 additions and 10 deletions
|
|
@ -21,7 +21,7 @@ var EventEmitter = require("../lib/event_emitter").EventEmitter;
|
||||||
var CommandManager = function(platform, commands) {
|
var CommandManager = function(platform, commands) {
|
||||||
this.platform = platform;
|
this.platform = platform;
|
||||||
this.commands = this.byName = {};
|
this.commands = this.byName = {};
|
||||||
this.commmandKeyBinding = {};
|
this.commandKeyBinding = {};
|
||||||
|
|
||||||
this.addCommands(commands);
|
this.addCommands(commands);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ module.exports.getEditorKeybordShortcuts = function(editor) {
|
||||||
var keybindings = [];
|
var keybindings = [];
|
||||||
var commandMap = {};
|
var commandMap = {};
|
||||||
editor.keyBinding.$handlers.forEach(function(handler) {
|
editor.keyBinding.$handlers.forEach(function(handler) {
|
||||||
var ckb = handler.commmandKeyBinding;
|
var ckb = handler.commandKeyBinding;
|
||||||
for (var i in ckb) {
|
for (var i in ckb) {
|
||||||
var modifier = parseInt(i);
|
var modifier = parseInt(i);
|
||||||
if (modifier == -1) {
|
if (modifier == -1) {
|
||||||
|
|
|
||||||
|
|
@ -198,7 +198,7 @@ exports.handler.bindKey = function(key, command) {
|
||||||
if (!key)
|
if (!key)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var ckb = this.commmandKeyBinding;
|
var ckb = this.commandKeyBinding;
|
||||||
key.split("|").forEach(function(keyPart) {
|
key.split("|").forEach(function(keyPart) {
|
||||||
keyPart = keyPart.toLowerCase();
|
keyPart = keyPart.toLowerCase();
|
||||||
ckb[keyPart] = command;
|
ckb[keyPart] = command;
|
||||||
|
|
@ -206,7 +206,7 @@ exports.handler.bindKey = function(key, command) {
|
||||||
// to be able to activate key combos with arbitrary length
|
// to be able to activate key combos with arbitrary length
|
||||||
// Example: if keyPart is "C-c C-l t" then "C-c C-l t" will
|
// Example: if keyPart is "C-c C-l t" then "C-c C-l t" will
|
||||||
// get command assigned and "C-c" and "C-c C-l" will get
|
// get command assigned and "C-c" and "C-c C-l" will get
|
||||||
// a null command assigned in this.commmandKeyBinding. For
|
// a null command assigned in this.commandKeyBinding. For
|
||||||
// the lookup logic see handleKeyboard()
|
// the lookup logic see handleKeyboard()
|
||||||
var keyParts = keyPart.split(" ").slice(0,-1);
|
var keyParts = keyPart.split(" ").slice(0,-1);
|
||||||
keyParts.reduce(function(keyMapKeys, keyPart, i) {
|
keyParts.reduce(function(keyMapKeys, keyPart, i) {
|
||||||
|
|
@ -257,9 +257,9 @@ exports.handler.handleKeyboard = function(data, hashId, key, keyCode) {
|
||||||
if (data.keyChain) key = data.keyChain += " " + key;
|
if (data.keyChain) key = data.keyChain += " " + key;
|
||||||
|
|
||||||
// Key combo prefixes get stored as "null" (String!) in this
|
// Key combo prefixes get stored as "null" (String!) in this
|
||||||
// this.commmandKeyBinding. When encountered no command is invoked but we
|
// this.commandKeyBinding. When encountered no command is invoked but we
|
||||||
// buld up data.keyChain
|
// buld up data.keyChain
|
||||||
var command = this.commmandKeyBinding[key];
|
var command = this.commandKeyBinding[key];
|
||||||
data.keyChain = command == "null" ? key : "";
|
data.keyChain = command == "null" ? key : "";
|
||||||
|
|
||||||
// there really is no command
|
// there really is no command
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ var useragent = require("../lib/useragent");
|
||||||
function HashHandler(config, platform) {
|
function HashHandler(config, platform) {
|
||||||
this.platform = platform || (useragent.isMac ? "mac" : "win");
|
this.platform = platform || (useragent.isMac ? "mac" : "win");
|
||||||
this.commands = {};
|
this.commands = {};
|
||||||
this.commmandKeyBinding = {};
|
this.commandKeyBinding = {};
|
||||||
|
|
||||||
this.addCommands(config);
|
this.addCommands(config);
|
||||||
};
|
};
|
||||||
|
|
@ -61,7 +61,7 @@ function HashHandler(config, platform) {
|
||||||
|
|
||||||
// exhaustive search is brute force but since removeCommand is
|
// exhaustive search is brute force but since removeCommand is
|
||||||
// not a performance critical operation this should be OK
|
// not a performance critical operation this should be OK
|
||||||
var ckb = this.commmandKeyBinding;
|
var ckb = this.commandKeyBinding;
|
||||||
for (var hashId in ckb) {
|
for (var hashId in ckb) {
|
||||||
for (var key in ckb[hashId]) {
|
for (var key in ckb[hashId]) {
|
||||||
if (ckb[hashId][key] == command)
|
if (ckb[hashId][key] == command)
|
||||||
|
|
@ -78,7 +78,7 @@ function HashHandler(config, platform) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var ckb = this.commmandKeyBinding;
|
var ckb = this.commandKeyBinding;
|
||||||
key.split("|").forEach(function(keyPart) {
|
key.split("|").forEach(function(keyPart) {
|
||||||
var binding = this.parseKeys(keyPart, command);
|
var binding = this.parseKeys(keyPart, command);
|
||||||
var hashId = binding.hashId;
|
var hashId = binding.hashId;
|
||||||
|
|
@ -158,7 +158,7 @@ function HashHandler(config, platform) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.findKeyCommand = function findKeyCommand(hashId, keyString) {
|
this.findKeyCommand = function findKeyCommand(hashId, keyString) {
|
||||||
var ckbr = this.commmandKeyBinding;
|
var ckbr = this.commandKeyBinding;
|
||||||
return ckbr[hashId] && ckbr[hashId][keyString];
|
return ckbr[hashId] && ckbr[hashId][keyString];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue