TUI: better display of stories
authorNiki Roo <niki@nikiroo.be>
Mon, 4 Mar 2019 14:09:32 +0000 (15:09 +0100)
committerNiki Roo <niki@nikiroo.be>
Mon, 4 Mar 2019 14:09:32 +0000 (15:09 +0100)
src/be/nikiroo/fanfix/reader/tui/TuiReaderStoryWindow.java

index ead70d4b0a116e58f6fdeb68ee4aae137e352004..51d8fa032fd9dbf8e575299c359e5cecec736761 100644 (file)
@@ -15,6 +15,7 @@ import jexer.event.TResizeEvent;
 import be.nikiroo.fanfix.data.Chapter;
 import be.nikiroo.fanfix.data.MetaData;
 import be.nikiroo.fanfix.data.Paragraph;
+import be.nikiroo.fanfix.data.Paragraph.ParagraphType;
 import be.nikiroo.fanfix.data.Story;
 import be.nikiroo.fanfix.library.BasicLibrary;
 
@@ -160,7 +161,13 @@ class TuiReaderStoryWindow extends TWindow {
                        builder.append("\n\n");
                        if (chap != null) {
                                for (Paragraph para : chap) {
-                                       builder.append(para.getContent()).append("\n\n");
+                                       if (para.getType() == ParagraphType.BREAK) {
+                                               builder.append("\n");
+                                       }
+                                       builder.append(para.getContent()).append("\n");
+                                       if (para.getType() == ParagraphType.BREAK) {
+                                               builder.append("\n");
+                                       }
                                }
                        }
                        textField.setText(builder.toString());