Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/gh_range_diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,13 @@ impl UnifiedDiffPrinter for HtmlDiffPrinter<'_> {
)?;
}

// Add potentially missing new-line after the last before diff line
if let Some(&last) = before.last() {
if !self.0[last].ends_with('\n') {
writeln!(f)?;
}
}

// Then process all after lines
for (diff, input) in &diffs_and_inputs {
self.handle_hunk_line(
Expand All @@ -574,6 +581,13 @@ impl UnifiedDiffPrinter for HtmlDiffPrinter<'_> {
}),
)?;
}

// Add potentially missing new-line after the last after diff line
if let Some(&last) = after.last() {
if !self.0[last].ends_with('\n') {
writeln!(f)?;
}
}
} else {
// Can't do word-highlighting, simply print each line.

Expand Down
Loading