File tree Expand file tree Collapse file tree 3 files changed +10
-2
lines changed
Expand file tree Collapse file tree 3 files changed +10
-2
lines changed Original file line number Diff line number Diff line change 1+ === 4.2.1
2+
3+ * Bug fixes
4+ * Fixed infinite loop with CR #339
5+
16=== 4.2.0 / 2014-12-06
27
38* Major enhancements
Original file line number Diff line number Diff line change @@ -68,11 +68,11 @@ def expand_tabs text
6868 expanded = [ ]
6969
7070 text . each_line do |line |
71- line . gsub! ( /^ ((?:.{8})*?)([^\t \r \n ]{0,7})\t / ) do
71+ nil while line . gsub! ( /(?: \G | \r ) ((?:.{8})*?)([^\t \r \n ]{0,7})\t / ) do
7272 r = "#{ $1} #{ $2} #{ ' ' * ( 8 - $2. size ) } "
7373 r . force_encoding text . encoding if Object . const_defined? :Encoding
7474 r
75- end until line !~ / \t /
75+ end
7676
7777 expanded << line
7878 end
Original file line number Diff line number Diff line change @@ -56,6 +56,9 @@ def test_expand_tabs
5656
5757 assert_equal ( '. .' ,
5858 expand_tabs ( ".\t \t ." ) , 'dot tab tab dot' )
59+
60+ assert_equal ( 'a a' ,
61+ Timeout . timeout ( 1 ) { expand_tabs ( "\r a\t a" ) } , "carriage return" )
5962 end
6063
6164 def test_expand_tabs_encoding
You can’t perform that action at this time.
0 commit comments