changeset 1461:ef9bb7457ebb

add dummy word for empty lines in plain.cc
author Johannes Hofmann <Johannes.Hofmann@gmx.de>
date Fri, 04 Dec 2009 19:39:31 +0100
parents a41372a38f02
children 8de487d495f7
files src/plain.cc
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/plain.cc	Wed Dec 02 17:40:33 2009 +0100
+++ b/src/plain.cc	Fri Dec 04 19:39:31 2009 +0100
@@ -139,10 +139,15 @@
    char buf[128];
    char *end = Buf + BufSize;
 
-   // Limit word len to avoid X11 coordinate
-   // overflow with extremely long lines.
-   while ((len = a_Misc_expand_tabs(&Buf, end, buf, sizeof(buf))))
-      DW2TB(dw)->addText(buf, len, widgetStyle);
+   if (BufSize > 0) {
+      // Limit word length to avoid X11 coordinate
+      // overflow with extremely long lines.
+      while ((len = a_Misc_expand_tabs(&Buf, end, buf, sizeof(buf))))
+         DW2TB(dw)->addText(buf, len, widgetStyle);
+   } else {
+      // Add dummy word for empty lines - otherwise the parbreak is ignored.
+      DW2TB(dw)->addText("", 0, widgetStyle);
+   }
 
    DW2TB(dw)->addParbreak(0, widgetStyle);
 }