Commit d2021256 authored by BrokenEagle's avatar BrokenEagle

Fix instances where a carriage return is replaced with another

- It was causing two <br> elements to be inserted
- Now the delete and insert paragraph marks are located next to each other
parent 094b9e6d
......@@ -20,6 +20,14 @@ class DiffBuilder
output.each { |q| q.replace(escape_html[q]) }
diffs.reverse_each do |hunk|
old_cr = hunk[0].try(:old_element)
new_cr = hunk[1].try(:new_element)
if old_cr && new_cr && old_cr.match?(/^\r?\n$/) && new_cr.match?(/^\r?\n$/)
hunk_position = hunk[0].old_position
output[hunk_position] = '<del><span class="paragraph-mark">¶</span></del><ins><span class="paragraph-mark">¶</span></ins><br>'
next
end
newchange = hunk.max {|a, b| a.old_position <=> b.old_position}
newstart = newchange.old_position
oldstart = hunk.min {|a, b| a.old_position <=> b.old_position}.old_position
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment