only add newline if there was a return\n before

This commit is contained in:
ndparker 2015-10-18 21:13:54 +02:00
parent 8ded33e800
commit bacec63561
1 changed files with 3 additions and 1 deletions

View File

@ -158,6 +158,7 @@ rjsmin(const rchar *source, rchar *target, Py_ssize_t length,
goto skip_or_copy_ws;
default:
xtarget = NULL;
if ( target == tstart
|| RJSMIN_IS_PRE_REGEX_1(*((pctoken ? pctoken : target)
- 1))
@ -182,8 +183,9 @@ rjsmin(const rchar *source, rchar *target, Py_ssize_t length,
reset = source;
if (spaced == U('\n')) {
*target++ = U('\n');
spaced = U(' ');
if (xtarget)
*target++ = U('\n');
}
*target++ = U('/');