diff --git a/src/dfmt.d b/src/dfmt.d index 20c414e..2273be8 100644 --- a/src/dfmt.d +++ b/src/dfmt.d @@ -740,8 +740,10 @@ private: { if (current.type == tok!";") { - write("; "); - currentLineLength += 2; + if (!(peekIs(tok!";") || peekIs(tok!")"))) + write("; "); + else + write(";"); index++; continue; } diff --git a/tests/issue0045.d b/tests/issue0045.d new file mode 100644 index 0000000..877e1a8 --- /dev/null +++ b/tests/issue0045.d @@ -0,0 +1,6 @@ +void doStuff() +{ + for (; ; ) { + } + for (size_t i = 0; i < se.len; ){} +} diff --git a/tests/issue0045.d.ref b/tests/issue0045.d.ref new file mode 100644 index 0000000..4183013 --- /dev/null +++ b/tests/issue0045.d.ref @@ -0,0 +1,9 @@ +void doStuff() +{ + for (;;) + { + } + for (size_t i = 0; i < se.len;) + { + } +}