diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-01-19 02:45:40 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-01-19 02:45:40 +0000 |
commit | 9dd9feab8adb54e813a87205977962c61030e3eb (patch) | |
tree | 05ea63f000b305ae9cf932288890a5012b3dbc8c /lib | |
parent | 459c590ca881a80af4583ce4e9fde52c2bf1faf2 (diff) |
merge revision(s) 49223: [Backport #10732]
* lib/rdoc/text.rb (expand_tabs): get rid of infinite loop with
CR. should check if substitution occurred too.
[ruby-dev:48813] [Bug #10732]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@49327 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/rdoc/text.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/rdoc/text.rb b/lib/rdoc/text.rb index 3a58641ec1..606f15eb0e 100644 --- a/lib/rdoc/text.rb +++ b/lib/rdoc/text.rb @@ -68,11 +68,11 @@ module RDoc::Text expanded = [] text.each_line do |line| - line.gsub!(/^((?:.{8})*?)([^\t\r\n]{0,7})\t/) do + nil while line.gsub!(/(?:\G|\r)((?:.{8})*?)([^\t\r\n]{0,7})\t/) do r = "#{$1}#{$2}#{' ' * (8 - $2.size)}" r.force_encoding text.encoding if Object.const_defined? :Encoding r - end until line !~ /\t/ + end expanded << line end |