small cleanup of editor.insert
This commit is contained in:
parent
3f8aa00d23
commit
eba12ee3a5
1 changed files with 3 additions and 5 deletions
|
|
@ -666,7 +666,6 @@ var Editor = function(renderer, session) {
|
||||||
this.insert = function(text) {
|
this.insert = function(text) {
|
||||||
var session = this.session;
|
var session = this.session;
|
||||||
var mode = session.getMode();
|
var mode = session.getMode();
|
||||||
|
|
||||||
var cursor = this.getCursorPosition();
|
var cursor = this.getCursorPosition();
|
||||||
|
|
||||||
if (this.getBehavioursEnabled()) {
|
if (this.getBehavioursEnabled()) {
|
||||||
|
|
@ -693,9 +692,8 @@ var Editor = function(renderer, session) {
|
||||||
|
|
||||||
var start = cursor.column;
|
var start = cursor.column;
|
||||||
var lineState = session.getState(cursor.row);
|
var lineState = session.getState(cursor.row);
|
||||||
var shouldOutdent = mode.checkOutdent(lineState, session.getLine(cursor.row), text);
|
|
||||||
var line = session.getLine(cursor.row);
|
var line = session.getLine(cursor.row);
|
||||||
var lineIndent = mode.getNextLineIndent(lineState, line.slice(0, cursor.column), session.getTabString());
|
var shouldOutdent = mode.checkOutdent(lineState, line, text);
|
||||||
var end = session.insert(cursor, text);
|
var end = session.insert(cursor, text);
|
||||||
|
|
||||||
if (transform && transform.selection) {
|
if (transform && transform.selection) {
|
||||||
|
|
@ -712,12 +710,12 @@ var Editor = function(renderer, session) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var lineState = session.getState(cursor.row);
|
|
||||||
|
|
||||||
// TODO disabled multiline auto indent
|
// TODO disabled multiline auto indent
|
||||||
// possibly doing the indent before inserting the text
|
// possibly doing the indent before inserting the text
|
||||||
// if (cursor.row !== end.row) {
|
// if (cursor.row !== end.row) {
|
||||||
if (session.getDocument().isNewLine(text)) {
|
if (session.getDocument().isNewLine(text)) {
|
||||||
|
var lineIndent = mode.getNextLineIndent(lineState, line.slice(0, cursor.column), session.getTabString());
|
||||||
|
|
||||||
this.moveCursorTo(cursor.row+1, 0);
|
this.moveCursorTo(cursor.row+1, 0);
|
||||||
|
|
||||||
var size = session.getTabSize();
|
var size = session.getTabSize();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue