diff options
author | Jesse Luehrs <doy@tozt.net> | 2019-12-07 02:53:54 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2019-12-07 02:55:43 -0500 |
commit | 7152bfd5772f64ec0fc7d7d204f5fd4986104823 (patch) | |
tree | e794694fd3817d7b5dd9e5909d442fcb06f494e2 /src/term.rs | |
parent | 1075c2888dffb261164d1f3c5a5d216c4a3f0d35 (diff) | |
download | vt100-rust-7152bfd5772f64ec0fc7d7d204f5fd4986104823.tar.gz vt100-rust-7152bfd5772f64ec0fc7d7d204f5fd4986104823.zip |
one more try for leaving a cursor at the end of a row
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"); } } |