]> git.ipfire.org Git - thirdparty/newt.git/commitdiff
bugfixes for text wrapping
authornotting <notting>
Wed, 19 Aug 1998 16:15:57 +0000 (16:15 +0000)
committernotting <notting>
Wed, 19 Aug 1998 16:15:57 +0000 (16:15 +0000)
textbox.c

index db42d955bbe4b1e97d4ac12878ef9b183c5a1a70..358dc3e3859a62ff59c8e09d8a0197036694f031 100644 (file)
--- a/textbox.c
+++ b/textbox.c
@@ -174,8 +174,11 @@ static void doReflow(const char * text, char ** resultPtr, int width,
            } else {
                chptr = text + width - 1;
                while (chptr > text && !isspace(*chptr)) chptr--;
-               while (isspace(*chptr)) chptr--;
+               while (chptr > text && isspace(*chptr)) chptr--;
                chptr++;
+               
+               if (chptr-text == 1 && !isspace(*chptr))
+                 chptr = text + width - 1;
 
                if (chptr > text)
                    howbad += width - (chptr - text) + 1;
@@ -185,7 +188,10 @@ static void doReflow(const char * text, char ** resultPtr, int width,
                    height++;
                }
 
-               text = chptr + 1;
+               if (isspace(*chptr))
+                   text = chptr + 1;
+               else
+                 text = chptr;
                while (isspace(*text)) text++;
            }
        }