Empty lines fix.

This commit is contained in:
Jindra Petřík
2024-08-17 12:26:38 +02:00
parent 996559ae01
commit e5e870f8b9
3 changed files with 14 additions and 12 deletions

View File

@@ -3873,7 +3873,12 @@ public class Graph {
*/
public static GraphTextWriter graphToString(List<GraphTargetItem> tree, GraphTextWriter writer, LocalData localData) throws InterruptedException {
boolean lastNewLine = true;
for (GraphTargetItem ti : tree) {
int tsize = tree.size();
if (!tree.isEmpty() && (tree.get(tree.size() - 1) instanceof ScriptEndItem)) {
tsize--;
}
for (int i = 0; i < tsize; i++) {
GraphTargetItem ti = tree.get(i);
if (!ti.isEmpty()) {
if (ti.hasSingleNewLineAround() && !lastNewLine) {
writer.newLine();
@@ -3882,8 +3887,8 @@ public class Graph {
if (!ti.handlesNewLine()) {
writer.newLine();
}
lastNewLine = false;
if (ti.hasSingleNewLineAround()) {
lastNewLine = false;
if (ti.hasSingleNewLineAround() && (i < tsize - 1)) {
writer.newLine();
lastNewLine = true;
}