mirror of
https://github.com/dandavison/delta.git
synced 2024-10-05 04:17:21 +03:00
802 fix color moved side by side panic (#803)
Append newline character when preparing raw line Fixes #802
This commit is contained in:
parent
a122013f07
commit
7d2ac30357
8
etc/examples/72-color-moved-4.diff
Normal file
8
etc/examples/72-color-moved-4.diff
Normal file
@ -0,0 +1,8 @@
|
||||
[1mdiff --git a/file.py b/file.py[m
|
||||
[1mindex f2f1f5e..9735c3a 100644[m
|
||||
[1m--- a/file.py[m
|
||||
[1m+++ b/file.py[m
|
||||
[36m@@ -1,2 +1,2 @@[m
|
||||
[1;35m-class X: pass # • unicode[m
|
||||
class Y: pass # • unicode[m
|
||||
[1;36m+[m[1;36mclass X: pass # • unicode[m
|
12
etc/examples/802-color-moved.diff
Normal file
12
etc/examples/802-color-moved.diff
Normal file
@ -0,0 +1,12 @@
|
||||
[33mcommit 57e5082[m
|
||||
Author: Caleb Maclennan <caleb@alerque.com>
|
||||
Date: Sat Nov 27 01:08:54 2021 +0300
|
||||
|
||||
Move verses to correct week file
|
||||
|
||||
[33mdiff --git a/foo.md b/foo.md[m
|
||||
[33mindex ba489f0..0ad8245 100644[m
|
||||
[33m--- a/foo.md[m
|
||||
[33m+++ b/foo.md[m
|
||||
[35m@@ -20,3 +20,99 @@[m [mfoo bar[m
|
||||
[1;36m+[m[1;36mAs I swore in my wrath, 'They shall not enter my rest.'"[m
|
@ -135,9 +135,13 @@ impl<'p> Painter<'p> {
|
||||
}
|
||||
}
|
||||
|
||||
// Remove initial -/+ character, and expand tabs as spaces, retaining ANSI sequences.
|
||||
// Remove initial -/+ character, expand tabs as spaces, retaining ANSI sequences. Terminate with
|
||||
// newline character.
|
||||
pub fn prepare_raw_line(&self, raw_line: &str) -> String {
|
||||
ansi::ansi_preserving_slice(&self.expand_tabs(raw_line.graphemes(true)), 1)
|
||||
format!(
|
||||
"{}\n",
|
||||
ansi::ansi_preserving_slice(&self.expand_tabs(raw_line.graphemes(true)), 1),
|
||||
)
|
||||
}
|
||||
|
||||
/// Expand tabs as spaces.
|
||||
|
Loading…
Reference in New Issue
Block a user