diff options
author | Joe Wilm <joe@jwilm.com> | 2016-06-06 16:54:15 -0700 |
---|---|---|
committer | Joe Wilm <joe@jwilm.com> | 2016-06-06 16:54:15 -0700 |
commit | cdea958e71fd59c8d2051feb4631badd6891e751 (patch) | |
tree | dc18120cb739e16a0c1a62eaaf42ff61091b3a7a /src/term.rs | |
parent | 6636cf6b9fa03a711f8c3aa2d6ca43248fecfc0f (diff) | |
download | alacritty-cdea958e71fd59c8d2051feb4631badd6891e751.tar.gz alacritty-cdea958e71fd59c8d2051feb4631badd6891e751.zip |
Add support for drawing background colors
Diffstat (limited to 'src/term.rs')
-rw-r--r-- | src/term.rs | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/term.rs b/src/term.rs index 5b00acfd..a552ee5d 100644 --- a/src/term.rs +++ b/src/term.rs @@ -2,7 +2,7 @@ use std::sync::Arc; use ansi::{self, Attr, DebugHandler}; -use grid::Grid; +use grid::{self, Grid, CellFlags}; use tty; use ::Rgb; @@ -89,7 +89,10 @@ pub struct Term { bg: Rgb, /// Tabstops - tabs: Vec<bool> + tabs: Vec<bool>, + + /// Cell attributes + attr: grid::CellFlags, } impl Term { @@ -111,6 +114,7 @@ impl Term { bg: DEFAULT_BG, tty: tty, tabs: tabs, + attr: CellFlags::empty(), } } @@ -158,6 +162,7 @@ impl Term { cell.c = c; cell.fg = self.fg; cell.bg = self.bg; + cell.flags = self.attr; } /// Advance to next line @@ -348,7 +353,14 @@ impl ansi::Handler for Term { Attr::Reset => { self.fg = DEFAULT_FG; self.bg = DEFAULT_BG; - } + self.attr = CellFlags::empty(); + }, + Attr::Reverse => { + self.attr.insert(grid::INVERSE); + }, + Attr::CancelReverse => { + self.attr.remove(grid::INVERSE); + }, _ => { println!("Term got unhandled attr: {:?}", attr); } |