diff --git a/src/dfmt/formatter.d b/src/dfmt/formatter.d index 56fc27a..3f6d1c7 100644 --- a/src/dfmt/formatter.d +++ b/src/dfmt/formatter.d @@ -749,7 +749,8 @@ private: } else if (peekBackIs(tok!"identifier") && (peekBack2Is(tok!"{", true) || peekBack2Is(tok!"}", true) || peekBack2Is(tok!";", true) - || peekBack2Is(tok!":", true)) && !(isBlockHeader(1) && !peekIs(tok!"if"))) + || peekBack2Is(tok!":", true) || peekBack2Is(tok!",", true)) + && !(isBlockHeader(1) && !peekIs(tok!"if"))) { writeToken(); if (isStructInitializer) diff --git a/tests/allman/issue0256.d.ref b/tests/allman/issue0256.d.ref index 2003daf..0a18239 100644 --- a/tests/allman/issue0256.d.ref +++ b/tests/allman/issue0256.d.ref @@ -1,6 +1,6 @@ void foo() { S s1 = {a: 3}; - S s2 = {a: 3, b : "test string"}; - S s3 = {a: 3, b : "test string", c : {x: 3.14, y : 3 + 4}}; + S s2 = {a: 3, b: "test string"}; + S s3 = {a: 3, b: "test string", c: {x: 3.14, y: 3 + 4}}; } diff --git a/tests/otbs/issue0256.d.ref b/tests/otbs/issue0256.d.ref index ed62ae0..576e0bd 100644 --- a/tests/otbs/issue0256.d.ref +++ b/tests/otbs/issue0256.d.ref @@ -1,5 +1,5 @@ void foo() { S s1 = {a: 3}; - S s2 = {a: 3, b : "test string"}; - S s3 = {a: 3, b : "test string", c : {x: 3.14, y : 3 + 4}}; + S s2 = {a: 3, b: "test string"}; + S s3 = {a: 3, b: "test string", c: {x: 3.14, y: 3 + 4}}; }