aboutsummaryrefslogtreecommitdiff
path: root/lib/interestingtimes.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/interestingtimes.c')
-rw-r--r--lib/interestingtimes.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/interestingtimes.c b/lib/interestingtimes.c
index c3ed9f9a..9cf84041 100644
--- a/lib/interestingtimes.c
+++ b/lib/interestingtimes.c
@@ -258,3 +258,20 @@ void tty_sigreset(int i)
tty_reset();
_exit(i ? 128+i : 0);
}
+
+void start_redraw(unsigned *width, unsigned *height)
+{
+ // If never signaled, do raw mode setup.
+ if (!toys.signal) {
+ *width = 80;
+ *height = 25;
+ set_terminal(0, 1, 0, 0);
+ sigatexit(tty_sigreset);
+ xsignal(SIGWINCH, generic_signal);
+ }
+ if (toys.signal != -1) {
+ toys.signal = -1;
+ terminal_probesize(width, height);
+ }
+ xprintf("\033[H\033[J");
+}