Skip to content

Commit 7d2ac30

Browse files
authored
802 fix color moved side by side panic (#803)
Append newline character when preparing raw line Fixes #802
1 parent a122013 commit 7d2ac30

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

etc/examples/72-color-moved-4.diff

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
diff --git a/file.py b/file.py
2+
index f2f1f5e..9735c3a 100644
3+
--- a/file.py
4+
+++ b/file.py
5+
@@ -1,2 +1,2 @@
6+
-class X: pass # • unicode
7+
class Y: pass # • unicode
8+
+class X: pass # • unicode

etc/examples/802-color-moved.diff

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
commit 57e5082
2+
Author: Caleb Maclennan <caleb@alerque.com>
3+
Date: Sat Nov 27 01:08:54 2021 +0300
4+
5+
Move verses to correct week file
6+
7+
diff --git a/foo.md b/foo.md
8+
index ba489f0..0ad8245 100644
9+
--- a/foo.md
10+
+++ b/foo.md
11+
@@ -20,3 +20,99 @@ foo bar
12+
+As I swore in my wrath, 'They shall not enter my rest.'"

src/paint.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,13 @@ impl<'p> Painter<'p> {
135135
}
136136
}
137137

138-
// Remove initial -/+ character, and expand tabs as spaces, retaining ANSI sequences.
138+
// Remove initial -/+ character, expand tabs as spaces, retaining ANSI sequences. Terminate with
139+
// newline character.
139140
pub fn prepare_raw_line(&self, raw_line: &str) -> String {
140-
ansi::ansi_preserving_slice(&self.expand_tabs(raw_line.graphemes(true)), 1)
141+
format!(
142+
"{}\n",
143+
ansi::ansi_preserving_slice(&self.expand_tabs(raw_line.graphemes(true)), 1),
144+
)
141145
}
142146

143147
/// Expand tabs as spaces.

0 commit comments

Comments
 (0)