Skip to content

Commit

Permalink
Performance improvement for HTML formatter when there are many change…
Browse files Browse the repository at this point in the history
…s in a single line
  • Loading branch information
JasonBarnabe committed Jun 15, 2014
1 parent 91fbdb1 commit adb6d1b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/diffy/html_formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,14 @@ def split_characters(chunk)
end

def reconstruct_characters(line_diff, type)
enum = line_diff.each_chunk
enum = line_diff.each_chunk.to_a
enum.each_with_index.map do |l, i|
re = /(^|\\n)#{Regexp.escape(type)}/
case l
when re
highlight(l)
when /^ /
if i > 1 and enum.to_a[i+1] and l.each_line.to_a.size < 4
if i > 1 and enum[i+1] and l.each_line.to_a.size < 4
highlight(l)
else
l.gsub(/^./, '').gsub("\n", '').
Expand Down

0 comments on commit adb6d1b

Please sign in to comment.