From 27cfc0ac5f70f7b706fb91fbe7f9f13f3f5edbf7 Mon Sep 17 00:00:00 2001 From: Jordan Doyle Date: Tue, 21 May 2024 11:46:19 +0200 Subject: [PATCH] Fix newlines not being inserted when code tags aren't used for line breaks --- src/git.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/git.rs b/src/git.rs index 6055553..6eec6cf 100644 --- a/src/git.rs +++ a/src/git.rs @@ -710,7 +710,8 @@ if line.len() > 2048 { // avoid highlighting overly complex lines - write!(out, "{}", Escape(line.trim_end()))?; + let line = if code_tag { line.trim_end() } else { line }; + write!(out, "{}", Escape(line))?; } else { let mut cur_index = 0; let ops = parse_state.parse_line(line, syntax_set)?; @@ -754,7 +755,7 @@ })?; } - let line = line.trim_end(); + let line = if code_tag { line.trim_end() } else { line }; if line.len() > cur_index { write!(out, "{}", Escape(&line[cur_index..]))?; } -- rgit 0.1.3