summaryrefslogtreecommitdiff
path: root/lib/rexml/formatters/pretty.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rexml/formatters/pretty.rb')
-rw-r--r--lib/rexml/formatters/pretty.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/rexml/formatters/pretty.rb b/lib/rexml/formatters/pretty.rb
index 78eab27402..22b6d857cd 100644
--- a/lib/rexml/formatters/pretty.rb
+++ b/lib/rexml/formatters/pretty.rb
@@ -57,8 +57,11 @@ module REXML
if compact
if node.children.inject(true) {|s,c| s & c.kind_of?(Text)}
string = ""
- node.children.each { |child| write( child, string, 0 ) }
- if string.length + @level < @width
+ old_level = @level
+ @level = 0
+ node.children.each { |child| write( child, string ) }
+ @level = old_level
+ if string.length < @width
output << string
skip = true
end