auto indent fix
This commit is contained in:
parent
78af5b6bae
commit
80a11082b1
2 changed files with 10 additions and 1 deletions
|
|
@ -426,7 +426,7 @@ var Editor =function(renderer, doc) {
|
|||
this.bgTokenizer.getState(cursor.row, function (lineState) {
|
||||
var shouldOutdent = _self.mode.checkOutdent(lineState, _self.doc.getLine(cursor.row), text);
|
||||
var line = _self.doc.getLine(cursor.row),
|
||||
lineIndent = _self.mode.getNextLineIndent(lineState, line, _self.doc.getTabString());
|
||||
lineIndent = _self.mode.getNextLineIndent(lineState, line.slice(0, cursor.column), _self.doc.getTabString());
|
||||
var end = _self.doc.insert(cursor, text);
|
||||
|
||||
/* TODO: This shortcut is somehow broken
|
||||
|
|
|
|||
|
|
@ -133,6 +133,15 @@ var Test = {
|
|||
editor.indent();
|
||||
assert.equal(["a12345", " b12345", "c12345"].join("\n"), doc.toString());
|
||||
},
|
||||
|
||||
"test: no auto indent if cursor is before the {" : function() {
|
||||
var doc = new Document("{", new JavaScriptMode());
|
||||
var editor = new Editor(new MockRenderer(), doc);
|
||||
|
||||
editor.moveCursorTo(0, 0);
|
||||
editor.onTextInput("\n");
|
||||
assert.equal(["", "{"].join("\n"), doc.toString());
|
||||
},
|
||||
|
||||
"test: outdent block" : function() {
|
||||
var doc = new Document([" a12345", " b12345", " c12345"].join("\n"));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue