Use alternate terminal buffer
A lot easier than I imagined. Is it portable enough?
This commit is contained in:
parent
c10f4a243b
commit
399adea68a
1 changed files with 4 additions and 0 deletions
|
@ -22,12 +22,16 @@ ERRCODE terminal_enable_raw(void) {
|
||||||
raw.c_cc[VTIME] = 1;
|
raw.c_cc[VTIME] = 1;
|
||||||
|
|
||||||
atexit(terminal_disable_raw);
|
atexit(terminal_disable_raw);
|
||||||
|
write(STDIN_FILENO, "\x1b[?1049h", 8);
|
||||||
|
|
||||||
return tcsetattr(STDIN_FILENO, TCSAFLUSH, &raw);
|
return tcsetattr(STDIN_FILENO, TCSAFLUSH, &raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
void terminal_disable_raw(void) {
|
void terminal_disable_raw(void) {
|
||||||
if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &E.orig_termios) == -1)
|
if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &E.orig_termios) == -1)
|
||||||
die ("term_disable_raw");
|
die ("term_disable_raw");
|
||||||
|
|
||||||
|
write(STDIN_FILENO, "\x1b[?1049l", 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
ERRCODE terminal_clear(void) {
|
ERRCODE terminal_clear(void) {
|
||||||
|
|
Reference in a new issue