- commit
- 4d33c514f5dc647d38702ff8fe41f190d4f599d5
- parent
- 818c7a2e3a2ac02f00c18388992303b87fc8f0dc
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2023-04-05 05:41
term: use alternative screen
Diffstat
| M | src/term.rs | 10 | +++++++--- |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/term.rs b/src/term.rs
@@ -19,8 +19,11 @@ mod ti {
19 19 pub fn cup(x: usize, y: usize) {
20 20 print!("\x1b[{};{}H", x + 1, y + 1);
21 21 }
22 -1 pub fn ed() {
23 -1 print!("\x1b[2J");
-1 22 pub fn smcup() {
-1 23 print!("\x1b[?1049h");
-1 24 }
-1 25 pub fn rmcup() {
-1 26 print!("\x1b[?1049l");
24 27 }
25 28 pub fn setab(color: [u8; 3]) {
26 29 print!("\x1b[48;2;{};{};{}m", color[0], color[1], color[2]);
@@ -105,11 +108,12 @@ impl Screen {
105 108
106 109 pub fn init(&mut self) {
107 110 self.resize();
-1 111 ti::smcup();
108 112 ti::civis();
109 -1 ti::ed();
110 113 }
111 114
112 115 pub fn restore(&self) {
-1 116 ti::rmcup();
113 117 ti::cnorm();
114 118 ti::sgr0();
115 119 }