Command+Backspace should remove until begin of line, Option+Backspace should remove token

fix #661
This commit is contained in:
Fabian Jakobs 2012-04-06 12:35:35 +02:00
commit 819bfe47ce
2 changed files with 10 additions and 10 deletions

View file

@ -91,7 +91,7 @@ var CommandManager = function(platform, commands) {
var key = typeof binding == "string" ? binding: binding[this.platform]; var key = typeof binding == "string" ? binding: binding[this.platform];
this.bindKey(key, command); this.bindKey(key, command);
} };
function parseKeys(keys, val, ret) { function parseKeys(keys, val, ret) {
var key; var key;
@ -108,10 +108,10 @@ var CommandManager = function(platform, commands) {
return { return {
key: key, key: key,
hashId: hashId hashId: hashId
} };
} }
function splitSafe(s, separator) { function splitSafe(s) {
return (s.toLowerCase() return (s.toLowerCase()
.trim() .trim()
.split(new RegExp("[\\s ]*\\-[\\s ]*", "g"), 999)); .split(new RegExp("[\\s ]*\\-[\\s ]*", "g"), 999));
@ -125,7 +125,7 @@ var CommandManager = function(platform, commands) {
var ckbr = this.commmandKeyBinding; var ckbr = this.commmandKeyBinding;
return ckbr[hashId] && ckbr[hashId][textOrKey.toLowerCase()]; return ckbr[hashId] && ckbr[hashId][textOrKey.toLowerCase()];
} };
this.exec = function(command, editor, args) { this.exec = function(command, editor, args) {
if (typeof command === 'string') if (typeof command === 'string')
@ -177,7 +177,7 @@ var CommandManager = function(platform, commands) {
this.exec(x, editor); this.exec(x, editor);
else else
this.exec(x[0], editor, x[1]); this.exec(x[0], editor, x[1]);
}, this) }, this);
} finally { } finally {
this.$inReplay = false; this.$inReplay = false;
} }
@ -189,9 +189,9 @@ var CommandManager = function(platform, commands) {
x[0] = x[0].name; x[0] = x[0].name;
if (!x[1]) if (!x[1])
x = x[0]; x = x[0];
return x return x;
}) });
} };
}).call(CommandManager.prototype); }).call(CommandManager.prototype);

View file

@ -334,13 +334,13 @@ exports.commands = [{
}, { }, {
name: "backspace", name: "backspace",
bindKey: bindKey( bindKey: bindKey(
"Ctrl-Backspace|Command-Backspace|Option-Backspace|Shift-Backspace|Backspace", "Command-Backspace|Option-Backspace|Shift-Backspace|Backspace",
"Ctrl-Backspace|Command-Backspace|Shift-Backspace|Backspace|Ctrl-H" "Ctrl-Backspace|Command-Backspace|Shift-Backspace|Backspace|Ctrl-H"
), ),
exec: function(editor) { editor.remove("left"); } exec: function(editor) { editor.remove("left"); }
}, { }, {
name: "removetolinestart", name: "removetolinestart",
bindKey: bindKey("Alt-Backspace", "Option-Backspace"), bindKey: bindKey("Alt-Backspace", "Command-Backspace"),
exec: function(editor) { editor.removeToLineStart(); } exec: function(editor) { editor.removeToLineStart(); }
}, { }, {
name: "removetolineend", name: "removetolineend",