aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md3
-rw-r--r--src/term/mod.rs29
2 files changed, 18 insertions, 14 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fa380e05..345f8a8c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Added ToggleFullscreen action
-- On macOS, there's a ToggleSimpleFullscreen action which allows switching to
+- On macOS, there's a ToggleSimpleFullscreen action which allows switching to
fullscreen without occupying another space
- A new window option `startup_mode` which controls how the window is created
@@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- On Windows, Alacritty will now use the native DirectWrite font API
- The `start_maximized` window option is now `startup_mode: Maximized`
+- Cells with identical foreground and background will now show their text upon selection/inversion
### Fixed
diff --git a/src/term/mod.rs b/src/term/mod.rs
index 0e95423d..2096e7a1 100644
--- a/src/term/mod.rs
+++ b/src/term/mod.rs
@@ -281,17 +281,19 @@ impl RenderableCell {
let mut bg_rgb = Self::compute_bg_rgb(colors, cell.bg);
let selection_background = config.colors().selection.background;
- let bg_alpha = if let (true, Some(col)) = (selected, selection_background) {
+ if let (true, Some(col)) = (selected, selection_background) {
// Override selection background with config colors
bg_rgb = col;
- 1.0
} else if selected ^ cell.inverse() {
- // Invert cell fg and bg colors
- mem::swap(&mut fg_rgb, &mut bg_rgb);
- Self::compute_bg_alpha(cell.fg)
- } else {
- Self::compute_bg_alpha(cell.bg)
- };
+ if fg_rgb == bg_rgb && !cell.flags.contains(Flags::HIDDEN) {
+ // Reveal inversed text when fg/bg is the same
+ fg_rgb = colors[NamedColor::Background];
+ bg_rgb = colors[NamedColor::Foreground];
+ } else {
+ // Invert cell fg and bg colors
+ mem::swap(&mut fg_rgb, &mut bg_rgb);
+ }
+ }
// Override selection text with config colors
if let (true, Some(col)) = (selected, config.colors().selection.text) {
@@ -304,7 +306,7 @@ impl RenderableCell {
inner: RenderableCellContent::Chars(cell.chars()),
fg: fg_rgb,
bg: bg_rgb,
- bg_alpha,
+ bg_alpha: Self::compute_bg_alpha(colors, bg_rgb),
flags: cell.flags,
}
}
@@ -347,10 +349,11 @@ impl RenderableCell {
}
#[inline]
- fn compute_bg_alpha(bg: Color) -> f32 {
- match bg {
- Color::Named(NamedColor::Background) => 0.0,
- _ => 1.0,
+ fn compute_bg_alpha(colors: &color::List, bg: Rgb) -> f32 {
+ if colors[NamedColor::Background] == bg {
+ 0.
+ } else {
+ 1.
}
}