Skip to content

Commit 9245909

Browse files
committed
Trim newlines on text inserted that does not need additional spans opening
1 parent 27cfc0a commit 9245909

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/git.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,8 +729,15 @@ fn format_file_inner(
729729
// of open spans, so we can open and close them for each line
730730
for &(i, ref op) in &ops {
731731
if i > cur_index {
732+
let prefix = &line[cur_index..i];
733+
let prefix = if code_tag {
734+
prefix.trim_end_matches('\n')
735+
} else {
736+
prefix
737+
};
738+
write!(out, "{}", Escape(prefix))?;
739+
732740
span_empty = false;
733-
write!(out, "{}", Escape(&line[cur_index..i]))?;
734741
cur_index = i;
735742
}
736743

0 commit comments

Comments
 (0)