From 5baf5e3559037074e13204d3a64e0a7e19d6a8c0 Mon Sep 17 00:00:00 2001 From: Hackerpilot Date: Thu, 19 Feb 2015 17:57:49 -0800 Subject: [PATCH] Fix interaction between newlines and semicolons --- src/dfmt.d | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/dfmt.d b/src/dfmt.d index 1f9e236..516b490 100644 --- a/src/dfmt.d +++ b/src/dfmt.d @@ -172,7 +172,7 @@ private: void formatStep() { import std.range : assumeSorted; - import std.algorithm : canFind; + import std.algorithm : canFind, startsWith; assert (index < tokens.length); if (current.type == tok!"comment") @@ -387,7 +387,8 @@ private: tempIndent = 0; writeToken(); linebreakHints = []; - if (index >= tokens.length || current.type != tok!"comment") + if (index >= tokens.length || current.type != tok!"comment" + || current.line != tokens[index - 1].line) newline(); if (peekImplementation(tok!"class",0)) newline();