diff options
author | Dan Davison <dandavison7@gmail.com> | 2020-08-01 22:45:02 -0400 |
---|---|---|
committer | Dan Davison <dandavison7@gmail.com> | 2020-08-01 22:45:02 -0400 |
commit | a0853ca53ee622d159f39e0d9e0d84523252381a (patch) | |
tree | d6de7b05f940b4f87f3150234351d3ecea09b110 /src/paint.rs | |
parent | 36db62d5d476d7f92b2ce00cdeb5ac7c346890d2 (diff) |
Set fill style for raw lines
Before this, if a color-moved color such as color.diff.oldMoved had a
background color, then the background color terminated with the text.
Diffstat (limited to 'src/paint.rs')
-rw-r--r-- | src/paint.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/paint.rs b/src/paint.rs index 3aed7c21..2639e1d0 100644 --- a/src/paint.rs +++ b/src/paint.rs @@ -304,8 +304,32 @@ impl<'a> Painter<'a> { // non_emph_style: for right fill if line contains emph sections let (style, non_emph_style) = match state { State::HunkMinus(None) => (config.minus_style, config.minus_non_emph_style), + State::HunkMinus(Some(raw_line)) => { + // TODO: This is the second time we are parsing the ANSI sequences + if let Some(ansi_term_style) = ansi::parse::parse_first_style(raw_line.bytes()) { + let style = Style { + ansi_term_style, + ..Style::new() + }; + (style, style) + } else { + (config.minus_style, config.minus_non_emph_style) + } + } State::HunkZero => (config.zero_style, config.zero_style), State::HunkPlus(None) => (config.plus_style, config.plus_non_emph_style), + State::HunkPlus(Some(raw_line)) => { + // TODO: This is the second time we are parsing the ANSI sequences + if let Some(ansi_term_style) = ansi::parse::parse_first_style(raw_line.bytes()) { + let style = Style { + ansi_term_style, + ..Style::new() + }; + (style, style) + } else { + (config.plus_style, config.plus_non_emph_style) + } + } _ => (config.null_style, config.null_style), }; let fill_style = if style_sections_contain_more_than_one_style(diff_sections) { |