diff --git a/src/dfmt/formatter.d b/src/dfmt/formatter.d index 9d740aa..b9d320a 100644 --- a/src/dfmt/formatter.d +++ b/src/dfmt/formatter.d @@ -261,7 +261,13 @@ private: { if (index < tokens.length && prevTokenEndLine == tokens[index].line) { - if (!currentIs(tok!"{")) + if (currentIs(tok!"}")) + { + if (indents.topIs(tok!"{")) + indents.pop(); + write(" "); + } + else if (!currentIs(tok!"{")) write(" "); } else if (!currentIs(tok!"{")) diff --git a/tests/allman/issue0151.d.ref b/tests/allman/issue0151.d.ref new file mode 100644 index 0000000..639e6bb --- /dev/null +++ b/tests/allman/issue0151.d.ref @@ -0,0 +1,7 @@ +void test() +{ /* ignore */ } + +void test2() +{ + test(); +} diff --git a/tests/issue0151.d b/tests/issue0151.d new file mode 100644 index 0000000..9b48a3b --- /dev/null +++ b/tests/issue0151.d @@ -0,0 +1,7 @@ +void test() +{ /* ignore */ } + + void test2() + { + test(); + } diff --git a/tests/otbs/issue0151.d.ref b/tests/otbs/issue0151.d.ref new file mode 100644 index 0000000..ac9e1a6 --- /dev/null +++ b/tests/otbs/issue0151.d.ref @@ -0,0 +1,5 @@ +void test() { /* ignore */ } + +void test2() { + test(); +}