diff options
Diffstat (limited to 'lib/output.js')
-rw-r--r-- | lib/output.js | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/lib/output.js b/lib/output.js index 82610fb6..cf05e261 100644 --- a/lib/output.js +++ b/lib/output.js @@ -100,7 +100,7 @@ function OutputStream(options) { } } - var indentation = 0; + var indentation = options.indent_start; var current_col = 0; var current_line = 1; var current_pos = 0; @@ -191,10 +191,6 @@ function OutputStream(options) { return name; } - function make_indent(back) { - return repeat_string(" ", options.indent_start + indentation - back * options.indent_level); - } - /* -----[ beautification/minification ]----- */ var has_parens = false; @@ -345,9 +341,7 @@ function OutputStream(options) { }; var indent = options.beautify ? function(half) { - if (options.beautify) { - print(make_indent(half ? 0.5 : 0)); - } + print(repeat_string(" ", half ? indentation - (options.indent_level >> 1) : indentation)); } : noop; var with_indent = options.beautify ? function(col, cont) { @@ -575,9 +569,9 @@ function OutputStream(options) { get : get, toString : get, indent : indent, - indentation : function() { return indentation }, - current_width : function() { return current_col - indentation }, - should_break : function() { return options.width && this.current_width() >= options.width }, + should_break : readonly ? noop : function() { + return options.width && current_col - indentation >= options.width; + }, has_parens : function() { return has_parens }, newline : newline, print : print, |