From: notting Date: Wed, 19 Aug 1998 16:15:57 +0000 (+0000) Subject: bugfixes for text wrapping X-Git-Tag: r0-30~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b198380e98ebcac64965e35b83a7facef04738e5;p=thirdparty%2Fnewt.git bugfixes for text wrapping --- diff --git a/textbox.c b/textbox.c index db42d95..358dc3e 100644 --- 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++; } }