Add clear_before, clear_after and clear_until_newline

This commit is contained in:
Ticki 2016-03-08 20:10:13 +01:00
parent a6d364e638
commit 62940e52f0
1 changed files with 12 additions and 0 deletions

View File

@ -16,10 +16,22 @@ pub trait TermControl {
fn clear(&mut self) -> IoResult<usize> { fn clear(&mut self) -> IoResult<usize> {
self.csi(b"2J") self.csi(b"2J")
} }
/// Clear everything _after_ the cursor.
fn clear_after(&mut self) -> IoResult<usize> {
self.csi(b"J")
}
/// Clear everything _before_ the cursor.
fn clear_before(&mut self) -> IoResult<usize> {
self.csi(b"1J")
}
/// Clear the current line. /// Clear the current line.
fn clear_line(&mut self) -> IoResult<usize> { fn clear_line(&mut self) -> IoResult<usize> {
self.csi(b"2K") self.csi(b"2K")
} }
/// Clear from the cursor until newline.
fn clear_until_newline(&mut self) -> IoResult<usize> {
self.csi(b"K")
}
/// Show the cursor. /// Show the cursor.
fn show_cursor(&mut self) -> IoResult<usize> { fn show_cursor(&mut self) -> IoResult<usize> {
self.csi(b"?25h") self.csi(b"?25h")