Skip to content

Commit 708667b

Browse files
thomasjmmarijnh
authored andcommitted
[multiplex addon] Fix bug with indentation
1 parent df4a306 commit 708667b

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

addon/mode/multiplex.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,15 @@ CodeMirror.multiplexingMode = function(outer /*, others */) {
5050
if (found == stream.pos) {
5151
if (!other.parseDelimiters) stream.match(other.open);
5252
state.innerActive = other;
53-
state.inner = CodeMirror.startState(other.mode, outer.indent ? outer.indent(state.outer, "") : 0);
53+
54+
// Get the outer indent, making sure to handle CodeMirror.Pass
55+
var outerIndent = 0;
56+
if (outer.indent) {
57+
var possibleOuterIndent = outer.indent(state.outer, "");
58+
if (possibleOuterIndent !== CodeMirror.Pass) outerIndent = possibleOuterIndent;
59+
}
60+
61+
state.inner = CodeMirror.startState(other.mode, outerIndent);
5462
return other.delimStyle && (other.delimStyle + " " + other.delimStyle + "-open");
5563
} else if (found != -1 && found < cutOff) {
5664
cutOff = found;

0 commit comments

Comments
 (0)