diff options
author | Joe Wilm <joe@jwilm.com> | 2016-07-01 21:13:09 -0700 |
---|---|---|
committer | Joe Wilm <joe@jwilm.com> | 2016-07-01 21:13:09 -0700 |
commit | a2ca10643f744244c635fb9b41a3c742e35213ea (patch) | |
tree | 7c36ead54423c6e7438803d945a3dc79ba72f249 /src/term.rs | |
parent | 9e45eea0c9af692dee1909b80d0c0552c385cf8c (diff) | |
download | r-alacritty-a2ca10643f744244c635fb9b41a3c742e35213ea.tar.gz r-alacritty-a2ca10643f744244c635fb9b41a3c742e35213ea.tar.bz2 r-alacritty-a2ca10643f744244c635fb9b41a3c742e35213ea.zip |
Implement Term::erase_chars
Fixes last known issue with htop. I think this implementation might not
be correct, but I don't yet understand the difference between erasing
and deleting (I imagine it's the difference between graphics state vs
grid state). Will probably need to circle back here.
Adds all range indexing operations to rows. Some were needed for the
erase_chars impl, and the rest are there for fully generality.
Diffstat (limited to 'src/term.rs')
-rw-r--r-- | src/term.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/term.rs b/src/term.rs index aff95b55..3ffe9c47 100644 --- a/src/term.rs +++ b/src/term.rs @@ -483,7 +483,17 @@ impl ansi::Handler for Term { self.scroll(count as isize); } } - fn erase_chars(&mut self, count: i64) { println!("erase_chars: {}", count); } + fn erase_chars(&mut self, count: i64) { + println!("erase_chars: {}", count); + let row_index = self.cursor.y as usize; + let col_index = self.cursor.x as usize; + let count = count as usize; + + let row = &mut self.grid[row_index]; + for c in &mut row[col_index..(count + col_index)] { + c.reset(); + } + } fn delete_chars(&mut self, count: i64) { println!("delete_chars: {}", count); } fn move_backward_tabs(&mut self, count: i64) { println!("move_backward_tabs: {}", count); } fn move_forward_tabs(&mut self, count: i64) { println!("move_forward_tabs: {}", count); } |