implement split line command

This commit is contained in:
Fabian Jakobs 2011-02-13 15:54:21 +01:00
commit 432873ed46
2 changed files with 17 additions and 0 deletions

View file

@ -257,6 +257,10 @@ canon.addCommand({
}
});
canon.addCommand({
canon.addCommand({
name: "splitline",
exec: function(env, args, request) { env.editor.splitLine(); }
});
name: "transposeletters",
exec: function(env, args, request) { env.editor.transposeLetters(); }
});

View file

@ -565,6 +565,19 @@ var Editor =function(renderer, session) {
this.clearSelection();
};
this.splitLine = function() {
if (this.$readOnly)
return;
if (!this.selection.isEmpty()) {
this.session.remove(this.getSelectionRange());
this.clearSelection();
}
var cursor = this.getCursorPosition();
this.insert("\n");
this.moveCursorToPosition(cursor);
};
this.transposeLetters = function() {
if (this.$readOnly)