diff --git a/src/dfmt/formatter.d b/src/dfmt/formatter.d index 36de9c9..cdc941b 100644 --- a/src/dfmt/formatter.d +++ b/src/dfmt/formatter.d @@ -347,7 +347,8 @@ private: { if (currentIs(tok!")") && indents.topIs(tok!",")) indents.pop(); - else if (peekBack2Is(tok!",") && !indents.topIs(tok!",")) + else if (peekBack2Is(tok!",") && !indents.topIs(tok!",") + && indents.indentToMostRecent(tok!"enum") == -1) indents.push(tok!","); newline(); } diff --git a/tests/allman/issue0207.d.ref b/tests/allman/issue0207.d.ref new file mode 100644 index 0000000..c26c44a --- /dev/null +++ b/tests/allman/issue0207.d.ref @@ -0,0 +1,11 @@ +enum a +{ + a, + b, + c, + d, + /* a comment */ + e, + f, + g +} diff --git a/tests/issue0207.d b/tests/issue0207.d new file mode 100644 index 0000000..051fb5a --- /dev/null +++ b/tests/issue0207.d @@ -0,0 +1,6 @@ +enum a +{ + a, b, c, d, + /* a comment */ + e, f, g +} diff --git a/tests/otbs/issue0207.d.ref b/tests/otbs/issue0207.d.ref new file mode 100644 index 0000000..5b779d8 --- /dev/null +++ b/tests/otbs/issue0207.d.ref @@ -0,0 +1,10 @@ +enum a { + a, + b, + c, + d, + /* a comment */ + e, + f, + g +}