fix regression which broke js auto indent

This commit is contained in:
Fabian Jakobs 2011-08-18 13:00:03 +02:00
commit 092839224f
2 changed files with 3 additions and 2 deletions

View file

@ -95,13 +95,13 @@ oop.inherits(Mode, TextMode);
return indent;
}
if (state == "start") {
if (state == "start" || state == "regex_allowed") {
var match = line.match(/^.*[\{\(\[\:]\s*$/);
if (match) {
indent += tab;
}
} else if (state == "doc-start") {
if (endState == "start") {
if (endState == "start" || state == "regex_allowed") {
return "";
}
var match = line.match(/^\s*(\/?)\*/);

View file

@ -117,6 +117,7 @@ module.exports = {
"test: no auto indent should add to existing indent" : function() {
assert.equal(" ", this.mode.getNextLineIndent("start", " if () {", " "));
assert.equal(" ", this.mode.getNextLineIndent("start", " cde", " "));
assert.equal(" ", this.mode.getNextLineIndent("regex_allowed", "function foo(items) {", " "));
},
"test: special indent in doc comments" : function() {