From 62940e52f0898ffc7c13c48652d254da47a56a15 Mon Sep 17 00:00:00 2001 From: Ticki Date: Tue, 8 Mar 2016 20:10:13 +0100 Subject: [PATCH] Add clear_before, clear_after and clear_until_newline --- src/control.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/control.rs b/src/control.rs index 9b35fc0..d8a6724 100644 --- a/src/control.rs +++ b/src/control.rs @@ -16,10 +16,22 @@ pub trait TermControl { fn clear(&mut self) -> IoResult { self.csi(b"2J") } + /// Clear everything _after_ the cursor. + fn clear_after(&mut self) -> IoResult { + self.csi(b"J") + } + /// Clear everything _before_ the cursor. + fn clear_before(&mut self) -> IoResult { + self.csi(b"1J") + } /// Clear the current line. fn clear_line(&mut self) -> IoResult { self.csi(b"2K") } + /// Clear from the cursor until newline. + fn clear_until_newline(&mut self) -> IoResult { + self.csi(b"K") + } /// Show the cursor. fn show_cursor(&mut self) -> IoResult { self.csi(b"?25h")