aboutsummaryrefslogtreecommitdiff
path: root/src/term/cell.rs
diff options
context:
space:
mode:
authorJoe Wilm <joe@jwilm.com>2017-05-28 09:38:10 -0700
committerJoe Wilm <jwilm@users.noreply.github.com>2017-06-11 13:21:13 -0700
commit529ac47fc81f12e953568826b87ef75568eaa83b (patch)
tree450024deb1f8d4340142d46a11ae9749cf786b77 /src/term/cell.rs
parent9825adf695a472be5d3316354f707c7d9d2d2730 (diff)
downloadalacritty-529ac47fc81f12e953568826b87ef75568eaa83b.tar.gz
alacritty-529ac47fc81f12e953568826b87ef75568eaa83b.zip
Add support for Beam, Underline cursors
Notable about this implementation is it takes a different approach for managing cursor cells that previously. The terminal Grid is now borrowed *immutably*. Instead of mutating Cells in the Grid, a list is managed within the RenderableCellsIter. The cell at the cursor location is skipped over, and instead cells are popped off a list of cursor cells. It would be good in the future to share some more code between the different cursor style implementations for populating the cursor cells list. Supercedes #349.
Diffstat (limited to 'src/term/cell.rs')
-rw-r--r--src/term/cell.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/term/cell.rs b/src/term/cell.rs
index cb966156..98d46bf2 100644
--- a/src/term/cell.rs
+++ b/src/term/cell.rs
@@ -86,6 +86,17 @@ impl Cell {
}
}
+ /// Get foreground and background colors adjusted for INVERSE flag
+ ///
+ /// First color is the foreground, second color is the background.
+ pub fn colors(&self, force_invert: bool) -> (&Color, &Color) {
+ if self.flags.contains(INVERSE) || force_invert {
+ (&self.bg, &self.fg)
+ } else {
+ (&self.fg, &self.bg)
+ }
+ }
+
#[inline]
pub fn is_empty(&self) -> bool {
self.c == ' ' &&