Show indentation changes in diffs.
Review Request #5351 — Created Jan. 29, 2014 and submitted — Latest diff uploaded
Show indentation changes in diffs.
We've always by default turned off showing inserts/deletes for lines
that only had indentation changes. This could make it hard to see that
those lines actually did change indentation, though.We now show indentation marks to help indicate this. For indented lines,
a faint green series of>
characters or------>|
strings are used on
the right-hand side of the diff to show indentation. If a line
unindents, then faint red<
characters or|<------
strings are shown
on the left.Sections of an equals block with indentation are treated like any other
modified section. They will always show up and won't be hidden under
collapsed sections.In order to ensure indentation-only changes to files were shown, I had
to remove the logic in diff_file_fragment.html that determines if we
should show the fragment. We were only showing the table if we had
changed chunks or under other special conditions (such as binary files).
In practice, this logic wasn't great anyway, and ended up showing a
single line of border and shadow for such changes. We already had a
condition that showed "No changes were made to this file," which is a
better thing to show.
Created some test files that did indents, unindents, and had mixes of tabs
and spaces. Verified they looked correct and matched what my editor showed,
and that the tabs all stayed confined to their tab boundaries.Added unit tests for all sorts of common and edge conditions. They passed.