From 0844a2ec8c0e1513d678d473bc02e522a2fcfa42 Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Wed, 7 Apr 2021 23:57:26 -0700 Subject: [PATCH] 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. --- src/commands.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/commands.rs b/src/commands.rs index 9f2f062b7..134748379 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -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)?;