fix cursor positioning on enter and indent
This commit is contained in:
parent
f505f97ec1
commit
8ac379a71e
1 changed files with 4 additions and 2 deletions
|
|
@ -405,6 +405,8 @@ var Editor =function(renderer, session) {
|
|||
var lineIndent = this.mode.getNextLineIndent(lineState, line.slice(0, cursor.column), this.session.getTabString());
|
||||
var end = this.session.insert(cursor, text);
|
||||
|
||||
this.moveCursorToPosition(end);
|
||||
|
||||
var lineState = this.bgTokenizer.getState(cursor.row);
|
||||
// multi line insert
|
||||
if (cursor.row !== end.row) {
|
||||
|
|
@ -435,14 +437,14 @@ var Editor =function(renderer, session) {
|
|||
outdent -= size;
|
||||
else if (line.charAt(i) == ' ')
|
||||
outdent -= 1;
|
||||
this.session.replace(new Range(row, 0, row, line.length), line.substr(i));
|
||||
this.session.remove(new Range(row, 0, row, i));
|
||||
}
|
||||
this.session.indentRows(cursor.row + 1, end.row, lineIndent);
|
||||
} else {
|
||||
if (shouldOutdent) {
|
||||
this.mode.autoOutdent(lineState, this.session, cursor.row);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
this.onTextInput = function(text) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue