Bug #342 ยป rexml_formatters_pretty_fix.patch
lib/rexml/formatters/pretty.rb (working copy) | ||
---|---|---|
def wrap(string, width)
|
||
# Recursively wrap string at width.
|
||
return string if string.length <= width
|
||
place = string.rindex(' ', width) # Position in string with last ' ' before cutoff
|
||
place = string.rindex(' ', width) || width # Position in string with last ' ' before cutoff
|
||
return string[0,place] + "\n" + wrap(string[place+1..-1], width)
|
||
end
|
||