Skip to content
Snippets Groups Projects
Commit 2cb42a96 authored by deuce's avatar deuce
Browse files

If we chop, make the next newline a hard CR.

parent 30888015
Branches
Tags
No related merge requests found
......@@ -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 */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment