From e1ccdcffb754943f20f1fa242b882bfffd6375b3 Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Wed, 7 Apr 2021 08:50:24 -0700 Subject: [PATCH] cli: don't lose short runs of context lines in diffs If the context was 3 lines or less, it would get lost before this patch. --- src/commands.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands.rs b/src/commands.rs index 4c2d1cb0e..f93b49886 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -697,7 +697,7 @@ fn print_diff(left: &[u8], right: &[u8], styler: &mut dyn Styler) { } } } else { - if context_before { + if context_before || context.len() < num_context_lines { for line in &context { print_diff_line(styler, line); }