@@ -20,7 +20,8 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
2020 blockKeywords = parserConfig . blockKeywords || { } ,
2121 atoms = parserConfig . atoms || { } ,
2222 hooks = parserConfig . hooks || { } ,
23- multiLineStrings = parserConfig . multiLineStrings ;
23+ multiLineStrings = parserConfig . multiLineStrings ,
24+ indentStatements = parserConfig . indentStatements !== false ;
2425 var isOperatorChar = / [ + \- * & % = < > ! ? | \/ ] / ;
2526
2627 var curPunc ;
@@ -151,7 +152,9 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
151152 while ( ctx . type == "statement" ) ctx = popContext ( state ) ;
152153 }
153154 else if ( curPunc == ctx . type ) popContext ( state ) ;
154- else if ( ( ( ctx . type == "}" || ctx . type == "top" ) && curPunc != ';' ) || ( ctx . type == "statement" && curPunc == "newstatement" ) )
155+ else if ( indentStatements &&
156+ ( ( ( ctx . type == "}" || ctx . type == "top" ) && curPunc != ';' ) ||
157+ ( ctx . type == "statement" && curPunc == "newstatement" ) ) )
155158 pushContext ( state , stream . column ( ) , "statement" ) ;
156159 state . startOfLine = false ;
157160 return style ;
@@ -385,6 +388,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
385388 multiLineStrings : true ,
386389 blockKeywords : words ( "catch class do else finally for forSome if match switch try while" ) ,
387390 atoms : words ( "true false null" ) ,
391+ indentStatements : false ,
388392 hooks : {
389393 "@" : function ( stream ) {
390394 stream . eatWhile ( / [ \w \$ _ ] / ) ;
0 commit comments