diff --git a/src/TextOutput.java b/src/TextOutput.java index f9ccee9..062c8c1 100644 --- a/src/TextOutput.java +++ b/src/TextOutput.java @@ -47,7 +47,7 @@ public class TextOutput { } else { - if (word.length() >= columnWidth - currentLength) { + if (word.length() >= columnWidth - currentLength && !(currentLength == 0)) { currentLength = 0; System.out.println(); } diff --git a/test/TextOutputTest.java b/test/TextOutputTest.java index 341cd8f..e3863aa 100644 --- a/test/TextOutputTest.java +++ b/test/TextOutputTest.java @@ -15,11 +15,12 @@ class TextOutputTest { public void setup(){ textOutput = new TextOutput(); textOutput.formatFix(9); - textOutput.formatRaw(); + //textOutput.formatRaw(); text = new ArrayList<>(); text.add("123456789"); text.add("1234"); text.add("12 12 12"); + text.add(" "); text.add("1eeeeeee8597389751"); text.add("TextTextTextTextTextTextTextTextTextTextTextTextTextText TextTextTextTextTextTextTextTextTextTextTextText TextTextText"); }