Indefero

Issue 636: The diff parser does not understand line ending changes

Reported by Thomas Keller, Mar 18, 2011

We need some sensible changes in the parsing and display of diffs 
that mungle line endings. Some examples (crlfs made visible):

dos2unix

  +foo\r\n
  -foo\n

unix2dos

  +foo\n
  -foo\r\n

newline added

  +foo
  \ No newline at end of file
  -foo\n

newline removed

  +foo\n
  -foo
  \ No newline at end of file

The current implementation just splits the input on \r\n|\n|\r and 
skips lines that denote missing newlines.


Proposal:

1) Implement custom line splitting, split on \r\n|\n|\r, but put the 
appropriate ending (if available) back

2) For \ No newline at the end of file case remove the implicit line 
ending that diff generated

3) In the diff renderer: if line ending changes or missing line 
endings occur (this could be remembered for each file already in the 
parser), make the now existing line endings visible, i.e. output 
"\n", "\r\n", "\r" or "%" 
(what some shells output as a placeholder for a missing newline), 
but with a different styling, for example with inverted colors.

Comment 1 by Thomas Keller, Oct 5, 2011

Work has been started with commit d0e2977. Fine tuning is still 
needed for the diff rendering part.
Status: Started
Owner: tommyd

Comment 2 by William Martin, Oct 5, 2011

Does your work on issue 636, can resolve issue 535 ?

Comment 3 by Thomas Keller, Oct 5, 2011

No, unfortunately not. I'm only dealing with the diff part of a 
changelog entry, not the changelog entry itself. But if you want to 
start on this, be my guest. This is another long-standing nuisance 
I'm facing in the source viewer.

Comment 4 by Thomas Keller, Oct 9, 2011

Whitespace handling and diff rendering is feature-complete since 
commit 464c1a8.

Comment 5 by Thomas Keller, Oct 10, 2011

This has been merged into develop.
Status: Fixed

Created: 2 years 2 months ago by Thomas Keller

Updated: 1 year 7 months ago

Status: Fixed

Owner: Thomas Keller

Followed by: 1 person

Labels:
Type:Defect
Priority:High
Milestone:Release1.2