File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -564,6 +564,13 @@ impl UnifiedDiffPrinter for HtmlDiffPrinter<'_> {
564564 ) ?;
565565 }
566566
567+ // Add potentially missing new-line after the last before diff line
568+ if let Some ( & last) = before. last ( ) {
569+ if !self . 0 [ last] . ends_with ( '\n' ) {
570+ writeln ! ( f) ?;
571+ }
572+ }
573+
567574 // Then process all after lines
568575 for ( diff, input) in & diffs_and_inputs {
569576 self . handle_hunk_line (
@@ -574,6 +581,13 @@ impl UnifiedDiffPrinter for HtmlDiffPrinter<'_> {
574581 } ) ,
575582 ) ?;
576583 }
584+
585+ // Add potentially missing new-line after the last after diff line
586+ if let Some ( & last) = after. last ( ) {
587+ if !self . 0 [ last] . ends_with ( '\n' ) {
588+ writeln ! ( f) ?;
589+ }
590+ }
577591 } else {
578592 // Can't do word-highlighting, simply print each line.
579593
You can’t perform that action at this time.
0 commit comments