diff --git a/src/sbbs3/js_global.c b/src/sbbs3/js_global.c index 65c37aaf23322e4be9bb8ade1fb8c8926d2d5d22..033e854c4e97fdb513637535b5bfe882c9d84425 100644 --- a/src/sbbs3/js_global.c +++ b/src/sbbs3/js_global.c @@ -747,12 +747,21 @@ js_word_wrap(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) if(prefix) strcpy(linebuf,prefix); l=prefix_bytes; - ocol=prefix_len; + ocol=prefix_len+1; i++; /* Do not keep the space (ie: cheat) for the first line of this quote block */ } i+=prefix_bytes-1; /* Keep the space (kinda a cheat... don't tell anyone) */ } - icol=prefix_len+1; + /* Now, if the NEXT char is also whitespace, it's still a hardcr... so there. */ + if(isspace(inbuf[i+1])) { + linebuf[l++]='\r'; + linebuf[l++]='\n'; + strncat(outbuf, linebuf, l); + if(prefix) + strcpy(linebuf,prefix); + l=prefix_bytes; + ocol=prefix_len+1; + } } else { linebuf[l++]='\r'; @@ -760,8 +769,8 @@ js_word_wrap(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) strncat(outbuf, linebuf, l); if(prefix) strcpy(linebuf,prefix); - l=prefix_bytes; - ocol=prefix_len; + l=0; + ocol=1; } } else { @@ -775,7 +784,7 @@ js_word_wrap(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) if(prefix) strcpy(linebuf,prefix); l=prefix_bytes; - ocol=prefix_len; + ocol=prefix_len+1; } else { /* Not a hard CR... add space if needed */ if(!isspace(linebuf[l-1])) @@ -787,7 +796,7 @@ js_word_wrap(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) linebuf[l++]=' '; } } - icol=1; + icol=prefix_len+1; break; case '\x1f': /* Delete... meaningless... strip. */ break; @@ -853,7 +862,7 @@ js_word_wrap(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) memmove(linebuf+l, linebuf+t, k-t); if(prefix) memcpy(linebuf,prefix,prefix_bytes); - ocol=prefix_len; + ocol=prefix_len+1; l+=k-t; /* Find new ocol */ for(ocol=prefix_len+1,t=0; t<l; t++) {