🏡 index : ~doyle/rgit.git

author Jordan Doyle <jordan@doyle.la> 2024-05-21 12:08:51.0 +02:00:00
committer Jordan Doyle <jordan@doyle.la> 2024-05-21 12:08:51.0 +02:00:00
commit
9245909d716bdfc3c54c35839f4009df7e943f9c [patch]
tree
dbe067ed7a562bddffe73df7490e3994bedd02c5
parent
27cfc0ac5f70f7b706fb91fbe7f9f13f3f5edbf7
download
9245909d716bdfc3c54c35839f4009df7e943f9c.tar.gz

Trim newlines on text inserted that does not need additional spans opening



Diff

 src/git.rs |  9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/git.rs b/src/git.rs
index 6eec6cf..fe0dda4 100644
--- a/src/git.rs
+++ a/src/git.rs
@@ -729,8 +729,15 @@
            // of open spans, so we can open and close them for each line
            for &(i, ref op) in &ops {
                if i > cur_index {
                    let prefix = &line[cur_index..i];
                    let prefix = if code_tag {
                        prefix.trim_end_matches('\n')
                    } else {
                        prefix
                    };
                    write!(out, "{}", Escape(prefix))?;

                    span_empty = false;
                    write!(out, "{}", Escape(&line[cur_index..i]))?;
                    cur_index = i;
                }