diff --git a/src/dfmt.d b/src/dfmt.d index 86d314e..6e75f01 100644 --- a/src/dfmt.d +++ b/src/dfmt.d @@ -438,7 +438,8 @@ private: { indentLevel++; writeToken(); - newline(); + if (!currentIs(tok!"{")) + newline(); } else if (peekBackIs(tok!"identifier") && (index <= 1 || peekBack2Is(tok!"{", true) || peekBack2Is(tok!"}", true) diff --git a/tests/issue0079.d b/tests/issue0079.d new file mode 100644 index 0000000..550d871 --- /dev/null +++ b/tests/issue0079.d @@ -0,0 +1,11 @@ +unittest +{ + switch (x) + { + case a: + { + } + case b: + return; + } +} diff --git a/tests/issue0079.d.ref b/tests/issue0079.d.ref new file mode 100644 index 0000000..ebeec6e --- /dev/null +++ b/tests/issue0079.d.ref @@ -0,0 +1,11 @@ +unittest +{ + switch (x) + { + case a: + { + } + case b: + return; + } +}