diff options
author | Nathan Lilienthal <nathan@nixpulvis.com> | 2021-04-30 18:16:48 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-30 22:16:48 +0000 |
commit | e3818a226c79f263d6e19fe83f411b199f7e55ef (patch) | |
tree | 7c526bee928fe084a65961df7dcdef36389e117b /alacritty/src/display/content.rs | |
parent | e2a853b1a787e63b401bcb518cc0edebcec4e958 (diff) | |
download | r-alacritty-e3818a226c79f263d6e19fe83f411b199f7e55ef.tar.gz r-alacritty-e3818a226c79f263d6e19fe83f411b199f7e55ef.tar.bz2 r-alacritty-e3818a226c79f263d6e19fe83f411b199f7e55ef.zip |
Use cell colors for focused match CellRgb
Fixes #5022.
Co-authored-by: Christian Duerr <contact@christianduerr.com>
Diffstat (limited to 'alacritty/src/display/content.rs')
-rw-r--r-- | alacritty/src/display/content.rs | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/alacritty/src/display/content.rs b/alacritty/src/display/content.rs index 8f1a74d6..4bef44f5 100644 --- a/alacritty/src/display/content.rs +++ b/alacritty/src/display/content.rs @@ -234,17 +234,13 @@ impl RenderableCell { bg_alpha = 1.0; } } else if content.search.advance(cell.point) { - // Highlight the cell if it is part of a search match. - let config_fg = colors.search.matches.foreground; - let config_bg = colors.search.matches.background; + let focused = content.focused_match.map_or(false, |fm| fm.contains(&cell.point)); + let (config_fg, config_bg) = if focused { + (colors.search.focused_match.foreground, colors.search.focused_match.background) + } else { + (colors.search.matches.foreground, colors.search.matches.background) + }; Self::compute_cell_rgb(&mut fg, &mut bg, &mut bg_alpha, config_fg, config_bg); - - // Apply the focused match colors, using the normal match colors as base reference. - if content.focused_match.map_or(false, |fm| fm.contains(&cell.point)) { - let config_fg = colors.search.focused_match.foreground; - let config_bg = colors.search.focused_match.background; - Self::compute_cell_rgb(&mut fg, &mut bg, &mut bg_alpha, config_fg, config_bg); - } } // Convert cell point to viewport position. |