diff options
author | Joe Wilm <joe@jwilm.com> | 2017-04-30 21:11:47 -0700 |
---|---|---|
committer | Joe Wilm <jwilm@users.noreply.github.com> | 2017-05-01 08:21:42 -0700 |
commit | 7d20d29f3742115c2228f2d1a3b6c7b2f6da20c0 (patch) | |
tree | e5f128e748fda3c77b9b2904d5075d15af8226a2 /src/term | |
parent | a99a69cfcb983b923cb89c6faf5ace3b89d786a5 (diff) | |
download | alacritty-7d20d29f3742115c2228f2d1a3b6c7b2f6da20c0.tar.gz alacritty-7d20d29f3742115c2228f2d1a3b6c7b2f6da20c0.zip |
Implement tab stop manipulation
Adds implementations for TBC (tabulation clear) and HTS (set horizontal
tabstop).
Diffstat (limited to 'src/term')
-rw-r--r-- | src/term/mod.rs | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/term/mod.rs b/src/term/mod.rs index 8f80a18d..191a1e04 100644 --- a/src/term/mod.rs +++ b/src/term/mod.rs @@ -1307,7 +1307,9 @@ impl ansi::Handler for Term { #[inline] fn set_horizontal_tabstop(&mut self) { - trace!("[unimplemented] set_horizontal_tabstop"); + trace!("set_horizontal_tabstop"); + let column = self.cursor.point.col; + self.tabs[column.0] = true; } #[inline] @@ -1502,7 +1504,21 @@ impl ansi::Handler for Term { #[inline] fn clear_tabs(&mut self, mode: ansi::TabulationClearMode) { - trace!("[unimplemented] clear_tabs: {:?}", mode); + trace!("clear_tabs: {:?}", mode); + match mode { + ansi::TabulationClearMode::Current => { + let column = self.cursor.point.col; + self.tabs[column.0] = false; + }, + ansi::TabulationClearMode::All => { + let len = self.tabs.len(); + // Safe since false boolean is null, each item occupies only 1 + // byte, and called on the length of the vec. + unsafe { + ::std::ptr::write_bytes(self.tabs.as_mut_ptr(), 0, len); + } + } + } } #[inline] |