From bacec6356191ff8a527b26473c2fc6fa95f5da26 Mon Sep 17 00:00:00 2001 From: ndparker Date: Sun, 18 Oct 2015 21:13:54 +0200 Subject: [PATCH] only add newline if there was a return\n before --- rjsmin.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rjsmin.c b/rjsmin.c index b7ce518..aa77a88 100644 --- a/rjsmin.c +++ b/rjsmin.c @@ -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('/');