Reset line length count only when actually wrapping

This commit is contained in:
andreyvolokitin 2018-01-22 01:33:23 +04:00 committed by Liam Newman
parent 6ed2116c4c
commit 35dc66afa3
2 changed files with 2 additions and 2 deletions

View File

@ -952,11 +952,11 @@ function Beautifier(html_source, options, js_beautify, css_beautify) {
}
this.print_newline = function(force, arr) {
this.line_char_count = 0;
if (!arr || !arr.length) {
return;
}
if (force || (arr[arr.length - 1] !== '\n')) { //we might want the extra line
this.line_char_count = 0;
if ((arr[arr.length - 1] !== '\n')) {
arr[arr.length - 1] = rtrim(arr[arr.length - 1]);
}

View File

@ -804,11 +804,11 @@ function Beautifier(html_source, options, js_beautify, css_beautify) {
}
this.print_newline = function(force, arr) {
this.line_char_count = 0;
if (!arr || !arr.length) {
return;
}
if (force || (arr[arr.length - 1] !== '\n')) { //we might want the extra line
this.line_char_count = 0;
if ((arr[arr.length - 1] !== '\n')) {
arr[arr.length - 1] = rtrim(arr[arr.length - 1]);
}