mirror of
https://github.com/beautifier/js-beautify.git
synced 2025-04-02 16:31:57 +00:00
Remove WSEat tracking
This commit is contained in:
parent
4b1748190d
commit
2c514e3daf
@ -182,7 +182,6 @@ function Beautifier(source_text, options) {
|
||||
|
||||
source_text = source_text || '';
|
||||
|
||||
var newlinesFromLastWSEat = 0;
|
||||
var indentSize = options.indent_size ? parseInt(options.indent_size, 10) : 4;
|
||||
var indentCharacter = options.indent_char || ' ';
|
||||
var preserve_newlines = (options.preserve_newlines === undefined) ? false : options.preserve_newlines;
|
||||
@ -274,7 +273,6 @@ function Beautifier(source_text, options) {
|
||||
}
|
||||
}
|
||||
}
|
||||
newlinesFromLastWSEat = result;
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -468,7 +466,7 @@ function Beautifier(source_text, options) {
|
||||
output.add_new_line();
|
||||
}
|
||||
|
||||
if (newlinesFromLastWSEat < 2 && newline_between_rules && indentLevel === 0) {
|
||||
if (newline_between_rules && indentLevel === 0 && !output.just_added_blankline()) {
|
||||
output.add_new_line(true);
|
||||
}
|
||||
} else {
|
||||
@ -502,7 +500,7 @@ function Beautifier(source_text, options) {
|
||||
output.add_new_line();
|
||||
}
|
||||
|
||||
if (newlinesFromLastWSEat < 2 && newline_between_rules && indentLevel === 0) {
|
||||
if (newline_between_rules && indentLevel === 0 && !output.just_added_blankline()) {
|
||||
output.add_new_line(true);
|
||||
}
|
||||
} else if (ch === ":") {
|
||||
|
@ -43,7 +43,6 @@ function Beautifier(source_text, options) {
|
||||
|
||||
source_text = source_text || '';
|
||||
|
||||
var newlinesFromLastWSEat = 0;
|
||||
var indentSize = options.indent_size ? parseInt(options.indent_size, 10) : 4;
|
||||
var indentCharacter = options.indent_char || ' ';
|
||||
var preserve_newlines = (options.preserve_newlines === undefined) ? false : options.preserve_newlines;
|
||||
@ -135,7 +134,6 @@ function Beautifier(source_text, options) {
|
||||
}
|
||||
}
|
||||
}
|
||||
newlinesFromLastWSEat = result;
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -329,7 +327,7 @@ function Beautifier(source_text, options) {
|
||||
output.add_new_line();
|
||||
}
|
||||
|
||||
if (newlinesFromLastWSEat < 2 && newline_between_rules && indentLevel === 0) {
|
||||
if (newline_between_rules && indentLevel === 0 && !output.just_added_blankline()) {
|
||||
output.add_new_line(true);
|
||||
}
|
||||
} else {
|
||||
@ -363,7 +361,7 @@ function Beautifier(source_text, options) {
|
||||
output.add_new_line();
|
||||
}
|
||||
|
||||
if (newlinesFromLastWSEat < 2 && newline_between_rules && indentLevel === 0) {
|
||||
if (newline_between_rules && indentLevel === 0 && !output.just_added_blankline()) {
|
||||
output.add_new_line(true);
|
||||
}
|
||||
} else if (ch === ":") {
|
||||
|
@ -72,7 +72,6 @@ class Printer:
|
||||
|
||||
def __init__(self, beautifier, indent_char, indent_size, default_indent=""):
|
||||
self.beautifier = beautifier
|
||||
self.newlines_from_last_ws_eat = 0
|
||||
self.indentSize = indent_size
|
||||
self.singleIndent = (indent_size) * indent_char
|
||||
self.indentLevel = 0
|
||||
@ -208,8 +207,6 @@ class Beautifier:
|
||||
isFirstNewLine = False
|
||||
self.output.add_new_line(True)
|
||||
result += 1
|
||||
|
||||
self.newlines_from_last_ws_eat = result
|
||||
return result
|
||||
|
||||
def skipWhitespace(self):
|
||||
@ -346,7 +343,7 @@ class Beautifier:
|
||||
if self.eatWhitespace(True) == 0:
|
||||
output.add_new_line()
|
||||
|
||||
if self.newlines_from_last_ws_eat < 2 and self.opts.newline_between_rules and printer.indentLevel == 0:
|
||||
if self.opts.newline_between_rules and printer.indentLevel == 0 and not output.just_added_blankline():
|
||||
output.add_new_line(True)
|
||||
else:
|
||||
printer.indent()
|
||||
@ -374,8 +371,7 @@ class Beautifier:
|
||||
if self.eatWhitespace(True) == 0:
|
||||
output.add_new_line()
|
||||
|
||||
|
||||
if self.newlines_from_last_ws_eat < 2 and self.opts.newline_between_rules and printer.indentLevel == 0:
|
||||
if self.opts.newline_between_rules and printer.indentLevel == 0 and not output.just_added_blankline():
|
||||
output.add_new_line(True)
|
||||
elif self.ch == ":":
|
||||
self.eatWhitespace()
|
||||
|
Loading…
x
Reference in New Issue
Block a user