samg / diffy

Easy Diffing in Ruby
http://rubygems.org/gems/diffy
MIT License
1.26k stars 103 forks source link

trailing newline eats last line in HTML diff #84

Open ninewise opened 7 years ago

ninewise commented 7 years ago

When the only difference between two string is a final newline, the last line disappears in the HTML diff.

> puts Diffy::Diff.new("1\n2", "1\n2\n").to_s
 1
-2
\ No newline at end of file
+2
 => nil
> puts Diffy::Diff.new("1\n2", "1\n2\n").to_s(:html)
<div class="diff">
  <ul>
    <li class="unchanged"><span>1</span></li>
  </ul>
</div>
 => nil