I ran a few tests and found no problems whatsoever.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3473 c06c8d41-db1a-0410-9941-cceddc491573
RGV4YBOIHCR2VLSRD7YUVWLEWXPJ25IT6JOJK5HRYS3UZLKYGWDAC
6HQB2N6N75R2RGKJFWRUN7WAC2PNGWQFXTII5DTRLTHZ2BOTMTVAC
Q5SFQO7ANODRI6OXKHPFQ4QWKGQ367S64DPURQW2TWK7ANTYO4NQC
SDLKLUNFGVKDS55DDJZCBAVIB7NL3RRYPTACAY65SCUQKV6APFSAC
5ASC3STDYCNLZFEBN6UTMUCGDETHBR2OCBZCF5VIAZ5RRWLOTDYQC
7NDXS36TE7QVXTXJWMYSVG5UHCCLPIO4VL6NXFGTDK3ZNKE3A2IAC
int xpos = 0, spacepos = 0;
int xpos = 0, spaceloc = 0;
// user-forced newline
// user-forced newline, or one we just stuffed in
{
// hard linebreak else if ( xpos >= maxcol )
// hard linebreak
else if ( xpos >= maxcol )
spaceloc = 0; ++loc; continue; } // force a wrap? if ( xpos >= maxcol )
spaceloc = 0;
++loc;
continue;
}
// force a wrap?
if ( xpos >= maxcol )
if (spacepos >= xpos-maxcol)
if (spaceloc)
loc = spacepos;
loc = spaceloc;
xpos = 0;
// reset pointers when we come around and see the \n continue;
// reset pointers when we come around and see the \n
// soft linebreak else if ( s[loc] == ' ' && xpos > 0)
// soft linebreak
else if ( s[loc] == ' ' && xpos > 0)
// save possible linebreak location if ( s[loc] == ' ' && xpos > 0)
// save possible linebreak location
if ( s[loc] == ' ' && xpos > 0)
spacepos = loc; ++xpos;
spacepos = loc;
++xpos;
spaceloc = loc;
// bog-standard else ++xpos;
// bog-standard
else