summaryrefslogtreecommitdiffstats
path: root/src/paint.rs
diff options
context:
space:
mode:
authorDan Davison <dandavison7@gmail.com>2020-05-28 16:17:56 -0400
committerDan Davison <dandavison7@gmail.com>2020-05-28 16:17:56 -0400
commit76c439f5051b9a869df302d86c979c61f8c9f560 (patch)
tree0a169ce161d705632a7e8c18cb5cebd64fcae9b2 /src/paint.rs
parentad9c0899c32217f42ce0b68e5191e16c69355c77 (diff)
Bug fix: emph background was right-filling if non-emph had no background
Diffstat (limited to 'src/paint.rs')
-rw-r--r--src/paint.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/paint.rs b/src/paint.rs
index 9816e167..ca311701 100644
--- a/src/paint.rs
+++ b/src/paint.rs
@@ -147,14 +147,19 @@ impl<'a> Painter<'a> {
}
ansi_strings.push(section_style.ansi_term_style.paint(text));
}
- ansi_strings.push(non_emph_style.ansi_term_style.paint(""));
+ // Set style for the right-fill.
+ let mut have_background_for_right_fill = false;
+ if non_emph_style.ansi_term_style.background.is_some() {
+ ansi_strings.push(non_emph_style.ansi_term_style.paint(""));
+ have_background_for_right_fill = true;
+ }
let line = &mut ansi_term::ANSIStrings(&ansi_strings).to_string();
let background_color_extends_to_terminal_width =
match background_color_extends_to_terminal_width {
Some(boolean) => boolean,
None => config.background_color_extends_to_terminal_width,
};
- if background_color_extends_to_terminal_width {
+ if background_color_extends_to_terminal_width && have_background_for_right_fill {
// HACK: How to properly incorporate the ANSI_CSI_ERASE_IN_LINE into ansi_strings?
if line
.to_lowercase()