Skip to content

Commit

Permalink
Always use non-emph style for right fill
Browse files Browse the repository at this point in the history
  • Loading branch information
dandavison committed Nov 20, 2021
1 parent adcd38c commit 5e82ffc
Showing 1 changed file with 13 additions and 23 deletions.
36 changes: 13 additions & 23 deletions src/paint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,46 +444,36 @@ impl<'p> Painter<'p> {
) -> (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)
}
let non_emph_style = match state {
State::HunkMinus(None) | State::HunkMinusWrapped => 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_first_style(raw_line) {
let style = Style {
Style {
ansi_term_style,
..Style::new()
};
(style, style)
}
} else {
(config.minus_style, config.minus_non_emph_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)
}
State::HunkZero | State::HunkZeroWrapped => config.zero_style,
State::HunkPlus(None) | State::HunkPlusWrapped => 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_first_style(raw_line) {
let style = Style {
Style {
ansi_term_style,
..Style::new()
};
(style, style)
}
} else {
(config.plus_style, config.plus_non_emph_style)
config.plus_non_emph_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(),
Expand Down

0 comments on commit 5e82ffc

Please sign in to comment.