Skip to content

Commit a08e65b

Browse files
committed
Prevent rewrites adding continous extra linefeeds
Previously when a rewriter would perform its rewrite, an extra linefeed was added. This comes about because when the last line in a module is replaced in the VBA IDE an extra linefeed is added.
1 parent 0ab3be8 commit a08e65b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Rubberduck.Parsing/Rewriter/ModuleRewriter.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,14 @@ public void Rewrite()
3333
return;
3434
}
3535

36-
var newCode = _rewriter.GetText();
36+
var tentativeCode = _rewriter.GetText();
37+
38+
while (tentativeCode.EndsWith(Environment.NewLine))
39+
{
40+
tentativeCode = tentativeCode.Remove(tentativeCode.Length - 2);
41+
};
42+
var newCode = tentativeCode;
43+
3744
_sourceCodeHandler.SubstituteCode(_module, newCode);
3845
}
3946

0 commit comments

Comments
 (0)