Fix adding/removing whole files

The 'remove unaligned lines at beginning of hunk' logic meant we just
discarded the whole hunk.

This breaks alignment again (previously fixed in 3ebbf268fd), but that
should be fixed properly in the padding logic.
ida_star
Wilfred Hughes 2021-08-08 23:15:01 +07:00
parent 15be123b20
commit 09a80150df
2 changed files with 5 additions and 9 deletions

@ -1,5 +1,10 @@
## 0.7 (unreleased)
### Diffing
Fixed issues when creating/removing a whole file meant that difftastic
didn't display anything.
### Display
Side-by-side display now uses "..." for column numbers when aligning

@ -832,17 +832,8 @@ pub fn aligned_lines(
// different number of lines, we can end up with extra padding on
// the side with fewer lines.
//
// Work around that by discarding any lines at the beginning with
// aren't matched.
//
// TODO: fix padding to be smarter.
//
// TODO: do the same for the end of the hunk.
aligned_lines_(&lhs_lines, &rhs_lines, lhs_line_matches)
.iter()
.skip_while(|(lhs, rhs)| lhs.is_none() || rhs.is_none())
.copied()
.collect()
}
/// Given two slices of contiguous line numbers, return pairs of