fix starting file newlines

This commit is contained in:
Sebastian McKenzie
2014-12-07 21:59:22 +11:00
parent f9f48620de
commit bd876f7a4d
2 changed files with 6 additions and 1 deletions

View File

@@ -66,7 +66,6 @@ Buffer.prototype.removeLast = function (cha) {
};
Buffer.prototype.newline = function (i, removeLast) {
if (!this.buf) return;
if (this.format.compact) return;
if (_.isBoolean(i)) {
@@ -88,7 +87,10 @@ Buffer.prototype.newline = function (i, removeLast) {
if (removeLast && this.isLast("\n")) this.removeLast("\n");
this.removeLast(" ");
// remove whitespace if last character was a newline
this.buf = this.buf.replace(/\n +$/, "\n");
this._push("\n");
};