diff --git a/src/dfmt.d b/src/dfmt.d index 6e75f01..87b7e37 100644 --- a/src/dfmt.d +++ b/src/dfmt.d @@ -426,15 +426,10 @@ private: writeToken(); break; case tok!":": - if (!assumeSorted(astInformation.attributeDeclarationLines) - .equalRange(current.line).empty) - { - writeToken(); - tempIndent = 0; - newline(); - } - else if (!assumeSorted(astInformation.caseEndLocations) - .equalRange(current.index).empty) + if (!assumeSorted(astInformation.caseEndLocations) + .equalRange(current.index).empty || !assumeSorted( + astInformation.attributeDeclarationLines).equalRange( + current.line).empty) { indentLevel++; writeToken(); @@ -1043,7 +1038,9 @@ private: && currentIs(tok!"identifier") && peekIs(tok!":") && (!isBlockHeader(2) || peek2Is(tok!"if")))) { - tempIndent--; + popIndent(); + if (braceIndents.length) + indentLevel = braceIndents.top(); } indent(); } diff --git a/tests/issue0090.d b/tests/issue0090.d new file mode 100644 index 0000000..d10d1cc --- /dev/null +++ b/tests/issue0090.d @@ -0,0 +1,10 @@ +unittest +{ +L1: + switch (x) + { + case Case: + doSomething(); + doSomethingElse(); + } +} diff --git a/tests/issue0090.d.ref b/tests/issue0090.d.ref new file mode 100644 index 0000000..02e0d14 --- /dev/null +++ b/tests/issue0090.d.ref @@ -0,0 +1,10 @@ +unittest +{ +L1: + switch (x) + { + case Case: + doSomething(); + doSomethingElse(); + } +}