diff --git a/lib/ace/editor.js b/lib/ace/editor.js index 65d31201..f040de5f 100644 --- a/lib/ace/editor.js +++ b/lib/ace/editor.js @@ -666,7 +666,6 @@ var Editor = function(renderer, session) { this.insert = function(text) { var session = this.session; var mode = session.getMode(); - var cursor = this.getCursorPosition(); if (this.getBehavioursEnabled()) { @@ -693,9 +692,8 @@ var Editor = function(renderer, session) { var start = cursor.column; var lineState = session.getState(cursor.row); - var shouldOutdent = mode.checkOutdent(lineState, session.getLine(cursor.row), text); 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); if (transform && transform.selection) { @@ -712,12 +710,12 @@ var Editor = function(renderer, session) { } } - var lineState = session.getState(cursor.row); - // TODO disabled multiline auto indent // possibly doing the indent before inserting the text // if (cursor.row !== end.row) { if (session.getDocument().isNewLine(text)) { + var lineIndent = mode.getNextLineIndent(lineState, line.slice(0, cursor.column), session.getTabString()); + this.moveCursorTo(cursor.row+1, 0); var size = session.getTabSize();