ok/jj
1
0
Fork 0
forked from mirrors/jj

diff: print context lines also when there are exactly 3 lines

My recent fix to print context lines when there are less than 3 lines
of context wasn't enough; we should also print context lines when
there are exactly 3 lines of context :) I can't understand what the
`!context_before` condition was for, so I've just removed it. I guess
I'll notice soon if things look worse in some case.
This commit is contained in:
Martin von Zweigbergk 2021-04-07 23:57:26 -07:00
parent ca3949135c
commit 0844a2ec8c

View file

@ -710,10 +710,8 @@ fn print_diff(left: &[u8], right: &[u8], styler: &mut dyn Styler) -> io::Result<
}
}
} else {
if context_before || context.len() < num_context_lines {
for line in &context {
print_diff_line(styler, line)?;
}
for line in &context {
print_diff_line(styler, line)?;
}
context.clear();
print_diff_line(styler, &diff_line)?;