implement split line command
This commit is contained in:
parent
a0b9140e18
commit
432873ed46
2 changed files with 17 additions and 0 deletions
|
|
@ -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(); }
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue