diff options
author | Dan Davison <dandavison7@gmail.com> | 2020-05-28 16:17:56 -0400 |
---|---|---|
committer | Dan Davison <dandavison7@gmail.com> | 2020-05-28 16:17:56 -0400 |
commit | 76c439f5051b9a869df302d86c979c61f8c9f560 (patch) | |
tree | 0a169ce161d705632a7e8c18cb5cebd64fcae9b2 /src/paint.rs | |
parent | ad9c0899c32217f42ce0b68e5191e16c69355c77 (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.rs | 9 |
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() |