From 41854aaeb6e30e5b7743b2475b9fadfc284c0e67 Mon Sep 17 00:00:00 2001 From: Hackerpilot Date: Sun, 25 Jan 2015 11:02:03 -0800 Subject: [PATCH] Fix #12 --- src/dfmt.d | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/dfmt.d b/src/dfmt.d index 7d9ae2d..d2e03eb 100644 --- a/src/dfmt.d +++ b/src/dfmt.d @@ -201,7 +201,12 @@ private: { writeToken(); tempIndent = 0; - if (current.type == tok!"comment") + if (index >= tokens.length) + { + newline(); + break; + } + if (current.type == tok!"comment") break; if (!(t == tok!"import" && current.type == tok!"import")) write("\n"); @@ -222,7 +227,7 @@ private: } assert (length_of_next_chunk > 0); writeToken(); - if (currentLineLength+1+length_of_next_chunk >= config.columnSoftLimit) + if (currentLineLength + 1 + length_of_next_chunk >= config.columnSoftLimit) { pushIndent(); newline();