diff options
author | Joe Wilm <joe@jwilm.com> | 2016-12-29 21:43:55 -0500 |
---|---|---|
committer | Joe Wilm <joe@jwilm.com> | 2016-12-29 21:43:55 -0500 |
commit | 26ac1df0b19a1c880d346493670cb816a5d8dc06 (patch) | |
tree | 66b4eec62d6e281825abc6c6fb7dcbcfb858b13f /src/term/cell.rs | |
parent | a91a3f2dce121a179a9371cd0ad1e548cf3d7731 (diff) | |
download | alacritty-26ac1df0b19a1c880d346493670cb816a5d8dc06.tar.gz alacritty-26ac1df0b19a1c880d346493670cb816a5d8dc06.zip |
Add Default impl for Cell
Just a bit of cleanup.
Diffstat (limited to 'src/term/cell.rs')
-rw-r--r-- | src/term/cell.rs | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/term/cell.rs b/src/term/cell.rs index db0cebcc..6bb1ab87 100644 --- a/src/term/cell.rs +++ b/src/term/cell.rs @@ -36,6 +36,17 @@ pub struct Cell { pub flags: Flags, } +impl Default for Cell { + fn default() -> Cell { + Cell::new( + ' ', + Color::Named(NamedColor::Foreground), + Color::Named(NamedColor::Background) + ) + } + +} + /// Get the length of occupied cells in a line pub trait LineLength { /// Calculate the occupied line length @@ -100,11 +111,10 @@ mod tests { use grid::Row; use index::Column; - use ansi::Color; #[test] fn line_length_works() { - let template = Cell::new(' ', Color::Indexed(0), Color::Indexed(0)); + let template = Cell::default(); let mut row = Row::new(Column(10), &template); row[Column(5)].c = 'a'; @@ -113,7 +123,7 @@ mod tests { #[test] fn line_length_works_with_wrapline() { - let template = Cell::new(' ', Color::Indexed(0), Color::Indexed(0)); + let template = Cell::default(); let mut row = Row::new(Column(10), &template); row[Column(9)].flags.insert(super::WRAPLINE); |