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

cli: fix git diff to not add context lines to count twice

We add `num_after_lines` to the line ranges just a few lines before
the place I removed the addition from in this patch.
This commit is contained in:
Martin von Zweigbergk 2022-02-05 15:43:37 -08:00
parent f294df6e8e
commit 80aeae48b5

View file

@ -2254,10 +2254,8 @@ fn unified_diff_hunks<'content>(
.saturating_sub(num_after_lines)
.saturating_sub(num_context_lines);
if num_skip_lines > 0 {
let left_start =
current_hunk.left_line_range.end + num_after_lines + num_skip_lines;
let right_start =
current_hunk.right_line_range.end + num_after_lines + num_skip_lines;
let left_start = current_hunk.left_line_range.end + num_skip_lines;
let right_start = current_hunk.right_line_range.end + num_skip_lines;
if !current_hunk.lines.is_empty() {
hunks.push(current_hunk);
}