Skip to content

Commit 452b18b

Browse files
committed
correctly display hunk length for last section
1 parent 1182f51 commit 452b18b

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

text/diff_util/file_diff.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -434,18 +434,12 @@ impl<'a> FileDiff<'a> {
434434

435435
// print final hunk
436436
if !diff_disp.hunk_lines.is_empty() {
437-
diff_disp.print_section();
438437
// display the remaining context if possible
439438
if diff_disp.curr_pos1 < self.file1.lines().len() {
440439
let end = self.file1.lines().len().min(diff_disp.curr_pos1 + unified);
441-
diff_disp.write_line(
442-
self.file1,
443-
diff_disp.curr_pos1,
444-
end,
445-
" ",
446-
)?;
447-
diff_disp.print_hunk();
440+
diff_disp.write_line(self.file1, diff_disp.curr_pos1, end, " ")?;
448441
}
442+
diff_disp.print_section();
449443
}
450444

451445
if !self.file1.ends_with_newline() {
@@ -549,5 +543,4 @@ impl DiffDisplay {
549543
println!("{}", self.hunk_lines);
550544
self.hunk_lines.clear();
551545
}
552-
553546
}

0 commit comments

Comments
 (0)