diff options
author | Jesse Luehrs <doy@tozt.net> | 2019-10-31 13:38:53 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2019-10-31 13:38:53 -0400 |
commit | 085115797e5698f1fa4599de41863999050d4b98 (patch) | |
tree | 782c71b216e2146a11ff7f6da1a9fe4034eac189 /src/cell.rs | |
parent | d808c39162273da61fec4d3273550149097726de (diff) | |
download | vt100-rust-085115797e5698f1fa4599de41863999050d4b98.tar.gz vt100-rust-085115797e5698f1fa4599de41863999050d4b98.zip |
implement zero-width and wide character handling
Diffstat (limited to 'src/cell.rs')
-rw-r--r-- | src/cell.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/cell.rs b/src/cell.rs index 2dc1ee4..3d2a9fa 100644 --- a/src/cell.rs +++ b/src/cell.rs @@ -14,6 +14,15 @@ impl Cell { self.attrs = a; } + pub(crate) fn append(&mut self, c: char) { + self.contents.push(c); + } + + pub(crate) fn reset(&mut self) { + self.contents = String::new(); + self.attrs = crate::attrs::Attrs::default(); + } + pub fn contents(&self) -> &str { &self.contents } @@ -22,6 +31,10 @@ impl Cell { self.contents != "" } + pub fn is_wide(&self) -> bool { + crate::unicode::str_width(&self.contents) > 1 + } + pub fn fgcolor(&self) -> crate::color::Color { self.attrs.fgcolor } |