Change: less \n in the listing if no content
authorNiki Roo <niki@nikiroo.be>
Mon, 19 Mar 2018 18:45:24 +0000 (19:45 +0100)
committerNiki Roo <niki@nikiroo.be>
Mon, 19 Mar 2018 18:45:24 +0000 (19:45 +0100)
src/be/nikiroo/gofetch/output/Gopher.java

index 7120dfac47f361011b9fbcf887af0003642765d3..51da87fb338f5ea4cd8fdc475a210035bf63f8a9 100644 (file)
@@ -118,6 +118,7 @@ public class Gopher extends Output {
                        builder.append("\r\n");
 
                        appendJustified(builder, false, story.getFullContent(), "    ");
+                       builder.append("\r\n");
                } else {
                        builder.append('0').append(story.getTitle()) //
                                        .append('\t').append(story.getSelector()) //
@@ -127,11 +128,13 @@ public class Gopher extends Output {
                        appendJustified(builder, true, story.getDetails(), "  ");
                        builder.append("i\r\n");
 
-                       appendJustified(builder, true, story.getContent(), "    ");
+                       String content = story.getContent();
+                       if (!content.isEmpty()) {
+                               appendJustified(builder, true, content, "    ");
+                               builder.append("i\r\n");
+                       }
                }
 
-               builder.append(resume ? "i" : "").append("\r\n");
-
                return builder;
        }