fixed error win unformatedtext class that resulted in println before each word.

This commit is contained in:
Leonardo Brandenberger 2021-11-05 18:25:20 +01:00
parent 7ac12a8ad5
commit a3b6388c9e
2 changed files with 3 additions and 2 deletions

View File

@ -47,7 +47,7 @@ public class TextOutput {
} }
else { else {
if (word.length() >= columnWidth - currentLength) { if (word.length() >= columnWidth - currentLength && !(currentLength == 0)) {
currentLength = 0; currentLength = 0;
System.out.println(); System.out.println();
} }

View File

@ -15,11 +15,12 @@ class TextOutputTest {
public void setup(){ public void setup(){
textOutput = new TextOutput(); textOutput = new TextOutput();
textOutput.formatFix(9); textOutput.formatFix(9);
textOutput.formatRaw(); //textOutput.formatRaw();
text = new ArrayList<>(); text = new ArrayList<>();
text.add("123456789"); text.add("123456789");
text.add("1234"); text.add("1234");
text.add("12 12 12"); text.add("12 12 12");
text.add(" ");
text.add("1eeeeeee8597389751"); text.add("1eeeeeee8597389751");
text.add("TextTextTextTextTextTextTextTextTextTextTextTextTextText TextTextTextTextTextTextTextTextTextTextTextText TextTextText"); text.add("TextTextTextTextTextTextTextTextTextTextTextTextTextText TextTextTextTextTextTextTextTextTextTextTextText TextTextText");
} }