diff --git a/src/sbbs3/wordwrap.c b/src/sbbs3/wordwrap.c index ab5e804f681e8f4be475ebd1f6d69b939778c140..168d554a83188ef099a269c820e07ae180b8ba25 100644 --- a/src/sbbs3/wordwrap.c +++ b/src/sbbs3/wordwrap.c @@ -216,6 +216,7 @@ char* wordwrap(char* inbuf, int len, int oldlen, BOOL handle_quotes) int outbuf_size=0; int inbuf_len=strlen(inbuf); unsigned next_len; + BOOL chopped = FALSE; outbuf_size=inbuf_len*3+1; if((outbuf=(char*)malloc(outbuf_size))==NULL) @@ -346,13 +347,16 @@ char* wordwrap(char* inbuf, int len, int oldlen, BOOL handle_quotes) icol=prefix_len+1; continue; } - else if(isspace((unsigned char)inbuf[i+1])) { /* Next line starts with whitespace. This is a "hard" CR. */ + else if(chopped || isspace((unsigned char)inbuf[i+1])) { /* Next line starts with whitespace. This is a "hard" CR. */ linebuf[l++]='\r'; linebuf[l++]='\n'; outbuf_append(&outbuf, &outp, linebuf, l, &outbuf_size); + if(prefix) + memcpy(linebuf,prefix,prefix_bytes); l=prefix_bytes; ocol=prefix_len+1; icol=prefix_len+1; + chopped = FALSE; continue; } else { @@ -411,6 +415,7 @@ char* wordwrap(char* inbuf, int len, int oldlen, BOOL handle_quotes) l--; if(l>0) l--; + chopped = TRUE; } t=l+1; /* Store start position of next line */ /* Move to start of whitespace */