diff options
author | Dan Davison <dandavison7@gmail.com> | 2021-11-20 11:20:08 -0500 |
---|---|---|
committer | Dan Davison <dandavison7@gmail.com> | 2021-11-28 18:28:22 -0500 |
commit | ff0921c39e7ca715808934934ce6985959e596e3 (patch) | |
tree | ac796ae2d345829e45e558f1d962edca016bb374 /src | |
parent | 39ef747843d3f49078a5402577bde8e6ae235b67 (diff) |
Always use non-emph style for right fill
Diffstat (limited to 'src')
-rw-r--r-- | src/paint.rs | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/src/paint.rs b/src/paint.rs index 79b44db1..3649f899 100644 --- a/src/paint.rs +++ b/src/paint.rs @@ -385,32 +385,21 @@ impl<'p> Painter<'p> { background_color_extends_to_terminal_width: BgShouldFill, config: &config::Config, ) -> (Option<BgFillMethod>, Style) { - // style: for right fill if line contains no emph sections - // non_emph_style: for right fill if line contains emph sections - let (style, non_emph_style) = match state { - State::HunkMinus(None) | State::HunkMinusWrapped => { - (config.minus_style, config.minus_non_emph_style) - } - State::HunkZero | State::HunkZeroWrapped => (config.zero_style, config.zero_style), - State::HunkPlus(None) | State::HunkPlusWrapped => { - (config.plus_style, config.plus_non_emph_style) - } + let non_emph_style = match state { + State::HunkMinus(None) | State::HunkMinusWrapped => config.minus_non_emph_style, + State::HunkZero | State::HunkZeroWrapped => config.zero_style, + State::HunkPlus(None) | State::HunkPlusWrapped => config.plus_non_emph_style, State::HunkMinus(Some(_)) | State::HunkPlus(Some(_)) => { - let style = if !diff_sections.is_empty() { + if !diff_sections.is_empty() { diff_sections[diff_sections.len() - 1].0 } else { config.null_style - }; - (style, style) + } } - State::Blame(_, _) => (diff_sections[0].0, diff_sections[0].0), - _ => (config.null_style, config.null_style), - }; - let fill_style = if style_sections_contain_more_than_one_style(diff_sections) { - non_emph_style // line contains an emph section - } else { - style + State::Blame(_, _) => diff_sections[0].0, + _ => config.null_style, }; + let fill_style = non_emph_style; match ( fill_style.get_background_color().is_some(), |