implement remove to line end

This commit is contained in:
Fabian Jakobs 2011-02-13 15:55:05 +01:00
commit 3715e90501
2 changed files with 16 additions and 0 deletions

View file

@ -242,6 +242,10 @@ canon.addCommand({
name: "backspace",
exec: function(env, args, request) { env.editor.removeLeft(); }
});
canon.addCommand({
name: "removetolineend",
exec: function(env, args, request) { env.editor.removeToLineEnd(); }
});
canon.addCommand({
name: "outdent",
exec: function(env, args, request) { env.editor.blockOutdent(); }
@ -261,6 +265,7 @@ canon.addCommand({
name: "splitline",
exec: function(env, args, request) { env.editor.splitLine(); }
});
canon.addCommand({
name: "transposeletters",
exec: function(env, args, request) { env.editor.transposeLetters(); }
});

View file

@ -564,6 +564,17 @@ var Editor =function(renderer, session) {
this.session.remove(this.getSelectionRange());
this.clearSelection();
};
this.removeToLineEnd = function() {
if (this.$readOnly)
return;
if (this.selection.isEmpty())
this.selection.selectLineEnd();
this.session.remove(this.getSelectionRange());
this.clearSelection();
};
this.splitLine = function() {
if (this.$readOnly)