diffy icon indicating copy to clipboard operation
diffy copied to clipboard

trailing newline eats last line in HTML diff

Open ninewise opened this issue 7 years ago • 0 comments

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

ninewise avatar May 03 '17 15:05 ninewise