summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Davison <dandavison7@gmail.com>2020-06-18 12:46:00 -0400
committerDan Davison <dandavison7@gmail.com>2020-06-18 12:47:20 -0400
commitf0e6c833b37bbd015074da1a3707de2991b3052c (patch)
tree384be3b84fd02d509bbc7fc704dcef5b669fe3f3
parentfbef92d8771b9cea2cf79fc4ddca0f2ac5de237b (diff)
Do not emit unnecessary ANSI sequence
https://github.com/dandavison/delta/pull/225#discussion_r442234332
-rw-r--r--src/paint.rs6
-rw-r--r--src/tests/test_example_diffs.rs6
2 files changed, 2 insertions, 10 deletions
diff --git a/src/paint.rs b/src/paint.rs
index f946853c..05bc714b 100644
--- a/src/paint.rs
+++ b/src/paint.rs
@@ -15,7 +15,6 @@ use crate::style::Style;
pub const ANSI_CSI_CLEAR_TO_EOL: &str = "\x1b[0K";
pub const ANSI_CSI_CLEAR_TO_BOL: &str = "\x1b[1K";
-pub const ANSI_CSI_CURSOR_BACK_1: &str = "\x1b[1D";
pub const ANSI_SGR_RESET: &str = "\x1b[0m";
pub struct Painter<'a> {
@@ -240,10 +239,7 @@ impl<'a> Painter<'a> {
output_buffer.push_str(
&empty_line_style
.ansi_term_style
- .paint(format!(
- "{}{}",
- ANSI_CSI_CLEAR_TO_BOL, ANSI_CSI_CURSOR_BACK_1
- ))
+ .paint(ANSI_CSI_CLEAR_TO_BOL)
.to_string(),
);
}
diff --git a/src/tests/test_example_diffs.rs b/src/tests/test_example_diffs.rs
index ec036044..f178aadf 100644
--- a/src/tests/test_example_diffs.rs
+++ b/src/tests/test_example_diffs.rs
@@ -1093,11 +1093,7 @@ impl<'a> Alignment<'a> { │
line,
&style
.ansi_term_style
- .paint(format!(
- "{}{}",
- paint::ANSI_CSI_CLEAR_TO_BOL,
- paint::ANSI_CSI_CURSOR_BACK_1
- ))
+ .paint(paint::ANSI_CSI_CLEAR_TO_BOL)
.to_string()
);
}