From 399adea68a11f73b079c172eaaaddb4b540fb341 Mon Sep 17 00:00:00 2001 From: Hadeed Ahmad Date: Tue, 26 Sep 2023 12:09:15 +0500 Subject: [PATCH] Use alternate terminal buffer A lot easier than I imagined. Is it portable enough? --- src/terminal.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/terminal.c b/src/terminal.c index 9448b21..214b479 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -22,12 +22,16 @@ ERRCODE terminal_enable_raw(void) { raw.c_cc[VTIME] = 1; atexit(terminal_disable_raw); + write(STDIN_FILENO, "\x1b[?1049h", 8); + return tcsetattr(STDIN_FILENO, TCSAFLUSH, &raw); } void terminal_disable_raw(void) { if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &E.orig_termios) == -1) die ("term_disable_raw"); + + write(STDIN_FILENO, "\x1b[?1049l", 8); } ERRCODE terminal_clear(void) {