fix excessive whitespace trimming resulting in innaccurate sourcemap line - fixes #151
This commit is contained in:
@@ -76,6 +76,8 @@ Buffer.prototype.newline = function (i, removeLast) {
|
||||
}
|
||||
|
||||
if (_.isNumber(i)) {
|
||||
if (this.endsWith(util.repeat(i, "\n"))) return;
|
||||
|
||||
var self = this;
|
||||
_.times(i, function () {
|
||||
self.newline(null, removeLast);
|
||||
@@ -86,7 +88,7 @@ Buffer.prototype.newline = function (i, removeLast) {
|
||||
if (removeLast && this.isLast("\n")) this.removeLast("\n");
|
||||
|
||||
this.removeLast(" ");
|
||||
this.buf = this.buf.replace(/\n(\s+)$/, "\n");
|
||||
this.buf = this.buf.replace(/\n +$/, "\n");
|
||||
this._push("\n");
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user