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; return indent;
} }
if (state == "start") { if (state == "start" || state == "regex_allowed") {
var match = line.match(/^.*[\{\(\[\:]\s*$/); var match = line.match(/^.*[\{\(\[\:]\s*$/);
if (match) { if (match) {
indent += tab; indent += tab;
} }
} else if (state == "doc-start") { } else if (state == "doc-start") {
if (endState == "start") { if (endState == "start" || state == "regex_allowed") {
return ""; return "";
} }
var match = line.match(/^\s*(\/?)\*/); var match = line.match(/^\s*(\/?)\*/);

View file

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