diff --git a/lib/ace/mode/javascript.js b/lib/ace/mode/javascript.js index 1302ad69..797d57e2 100644 --- a/lib/ace/mode/javascript.js +++ b/lib/ace/mode/javascript.js @@ -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*(\/?)\*/); diff --git a/lib/ace/mode/javascript_test.js b/lib/ace/mode/javascript_test.js index 0e0d3f08..e2a89be5 100644 --- a/lib/ace/mode/javascript_test.js +++ b/lib/ace/mode/javascript_test.js @@ -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() {