Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lines different only by newline character don't come up as different in HTML mode only #38

Closed
JasonBarnabe opened this issue Mar 11, 2014 · 2 comments

Comments

@JasonBarnabe
Copy link
Contributor

Diffy 3.0.2, Ruby 2.0.0.

2.0.0p247 :014 > Diffy::Diff.new("one\ntwo\nthree\n", "one\r\ntwo\r\nthree\r\n").to_s
 => "-one\n-two\n-three\n+one\r\n+two\r\n+three\r\n" 
2.0.0p247 :015 > Diffy::Diff.new("one\ntwo\nthree\n", "one\r\ntwo\r\nthree\r\n").to_s(:html_simple)
 => "<div class=\"diff\">\n  <ul>\n    <li class=\"del\"><del>one</del></li>\n    <li class=\"del\"><del>two</del></li>\n    <li class=\"del\"><del>three</del></li>\n    <li class=\"ins\"><ins>one</ins></li>\n    <li class=\"ins\"><ins>two</ins></li>\n    <li class=\"ins\"><ins>three</ins></li>\n  </ul>\n</div>\n" 
2.0.0p247 :016 > Diffy::Diff.new("one\ntwo\nthree\n", "one\r\ntwo\r\nthree\r\n").to_s(:html)
 => "<div class=\"diff\"></div>" 

Why would these not show up as different when using :html output only?

@samg
Copy link
Owner

samg commented Mar 16, 2014

Looks like a bug in the html formatter. That piece of code is fairly complex, due to the inline highlighting ability, and it looks like you've found an edge case it doesn't handle well.

I'm not sure when I'll be able to look into it, but I'll plan to investigate it at some point. Also feel free to submit a pull request with a failing test case (or a fix to the issue).

Thanks!

@samg samg closed this as completed in 2054760 Mar 17, 2014
@samg
Copy link
Owner

samg commented Apr 15, 2014

This should be fixed now in version 3.0.4 of the gem. Thanks!

samg added a commit that referenced this issue Apr 15, 2014
handle windows vs. unix line breaks consistently in html output

Issue #38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants