diff options
Diffstat (limited to 'src/term.rs')
-rw-r--r-- | src/term.rs | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/src/term.rs b/src/term.rs index 0a578c1..31e1f51 100644 --- a/src/term.rs +++ b/src/term.rs @@ -26,31 +26,41 @@ impl BufWrite for ClearRowForward { #[derive(Default, Debug)] #[must_use = "this struct does nothing unless you call write_buf"] -pub struct ClearRowBackward; +pub struct CRLF; -impl BufWrite for ClearRowBackward { +impl BufWrite for CRLF { fn write_buf(&self, buf: &mut Vec<u8>) { - buf.extend_from_slice(b"\x1b[1K"); + buf.extend_from_slice(b"\r\n"); } } #[derive(Default, Debug)] #[must_use = "this struct does nothing unless you call write_buf"] -pub struct CRLF; +pub struct Backspace; -impl BufWrite for CRLF { +impl BufWrite for Backspace { fn write_buf(&self, buf: &mut Vec<u8>) { - buf.extend_from_slice(b"\r\n"); + buf.extend_from_slice(b"\x08"); } } #[derive(Default, Debug)] #[must_use = "this struct does nothing unless you call write_buf"] -pub struct Backspace; +pub struct SaveCursor; -impl BufWrite for Backspace { +impl BufWrite for SaveCursor { fn write_buf(&self, buf: &mut Vec<u8>) { - buf.extend_from_slice(b"\x08"); + buf.extend_from_slice(b"\x1b7"); + } +} + +#[derive(Default, Debug)] +#[must_use = "this struct does nothing unless you call write_buf"] +pub struct RestoreCursor; + +impl BufWrite for RestoreCursor { + fn write_buf(&self, buf: &mut Vec<u8>) { + buf.extend_from_slice(b"\x1b8"); } } |