Skip to content

Commit 65ae9dd

Browse files
committed
Fix #98
1 parent 2410311 commit 65ae9dd

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

src/dfmt.d

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,8 +1024,9 @@ private:
10241024
while (indents.length && isWrapIndent(indents.top))
10251025
indents.pop();
10261026
indents.push(tok!"{");
1027-
if (index == 1 || peekBackIs(tok!":") || peekBackIs(tok!"{")
1028-
|| peekBackIs(tok!"}") || peekBackIs(tok!")") || peekBackIs(tok!";"))
1027+
if (index == 1 || peekBackIs(tok!":", true) || peekBackIs(tok!"{", true)
1028+
|| peekBackIs(tok!"}", true) || peekBackIs(tok!")", true)
1029+
|| peekBackIs(tok!";", true))
10291030
{
10301031
indentLevel = indents.indentSize - 1;
10311032
}

tests/issue0098.d

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
unittest
2+
{
3+
if (!fdmatch)
4+
goto Lfd; // comment
5+
{
6+
}
7+
}

tests/issue0098.d.ref

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
unittest
2+
{
3+
if (!fdmatch)
4+
goto Lfd; // comment
5+
{
6+
}
7+
}

0 commit comments

Comments
 (0)