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

View file

@ -334,13 +334,13 @@ exports.commands = [{
}, {
name: "backspace",
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"
),
exec: function(editor) { editor.remove("left"); }
}, {
name: "removetolinestart",
bindKey: bindKey("Alt-Backspace", "Option-Backspace"),
bindKey: bindKey("Alt-Backspace", "Command-Backspace"),
exec: function(editor) { editor.removeToLineStart(); }
}, {
name: "removetolineend",