Implement tab stop manipulation

Adds implementations for TBC (tabulation clear) and HTS (set horizontal
tabstop).
This commit is contained in:
Joe Wilm 2017-04-30 21:11:47 -07:00 committed by Joe Wilm
parent a99a69cfcb
commit 7d20d29f37
5 changed files with 44 additions and 2 deletions

View File

@ -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]

View File

@ -40,6 +40,7 @@ ref_tests! {
vttest_origin_mode_1
vttest_origin_mode_2
vttest_scroll
vttest_tab_clear_set
zsh_tab_completion
}

View File

@ -0,0 +1,23 @@
% jwilm@sanctuary.local ➜  ~/code/alacritty  [?1h=[?2004hvvtvttteesvttest[?1l>[?2004l
[?1l[?3l[?4l[?5l[?6l[?7h[?8l[?40h[?45lVT100 test program, version 2.7 (20140305)Choose test type:

0. Exit
1. Test of cursor movements
2. Test of screen features
3. Test of character sets
4. Test of double-sized characters
5. Test of keyboard
6. Test of terminal reports
7. Test of VT52 mode
8. Test of VT102 features (Insert/Delete Char/Line)
9. Test of known bugs
10. Test of reset and self-test
11. Test non-VT100 (e.g., VT220, XTERM) terminals
12. Modify test-parameters
Enter choice number (0 - 12): 2
[?7h****************************************************************************************************************************************************************[?7l****************************************************************************************************************************************************************[?7hThis should be three identical lines of *'s completely filling
the top of the screen without any empty lines between.
(Test of WRAP AROUND mode setting.)
Push <RETURN>HHHHHHHHHHHHHHHHHHHHHHHHHH * * * * * * * * * * * * * * * * * * * * * * * * * *Test of TAB setting/resetting. These two lines
should look the same. Push <RETURN>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
{"width":1124.0,"height":676.0,"cell_width":14.0,"cell_height":28.0}