summaryrefslogtreecommitdiffstats
path: root/video/out/vo_tct.c
diff options
context:
space:
mode:
authorMia Herkt <mia@0x0.st>2022-12-17 05:27:50 +0100
committermia <652892+mia-0@users.noreply.github.com>2022-12-19 13:48:49 +0100
commit1564e4f29fb7a2094e0b24899fad91838b569a42 (patch)
tree7c2fb858e308ef19ce330fe77197c7329680727d /video/out/vo_tct.c
parentb5373079f20aeeba8ac80e773f3cc05692dbb51f (diff)
downloadmpv-1564e4f29fb7a2094e0b24899fad91838b569a42.tar.bz2
mpv-1564e4f29fb7a2094e0b24899fad91838b569a42.tar.xz
vo_tct: Use the alternate buffer to restore term
Diffstat (limited to 'video/out/vo_tct.c')
-rw-r--r--video/out/vo_tct.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/video/out/vo_tct.c b/video/out/vo_tct.c
index ac224b9397..a9b92ce349 100644
--- a/video/out/vo_tct.c
+++ b/video/out/vo_tct.c
@@ -42,6 +42,8 @@
#define ESC_RESTORE_CURSOR "\033[?25h"
#define ESC_CLEAR_SCREEN "\033[2J"
#define ESC_CLEAR_COLORS "\033[0m"
+#define ESC_SAVE_SCREEN "\033[?1049h"
+#define ESC_RESTORE_SCREEN "\033[?1049l"
#define ESC_GOTOXY "\033[%d;%df"
#define ESC_COLOR_BG "\033[48;2"
#define ESC_COLOR_FG "\033[38;2"
@@ -255,8 +257,8 @@ static int reconfig(struct vo *vo, struct mp_image_params *params)
if (mp_sws_reinit(p->sws) < 0)
return -1;
- printf(ESC_HIDE_CURSOR);
printf(ESC_CLEAR_SCREEN);
+
vo->want_redraw = true;
return 0;
}
@@ -297,8 +299,7 @@ static void flip_page(struct vo *vo)
static void uninit(struct vo *vo)
{
printf(ESC_RESTORE_CURSOR);
- printf(ESC_CLEAR_SCREEN);
- printf(ESC_GOTOXY, 0, 0);
+ printf(ESC_RESTORE_SCREEN);
struct priv *p = vo->priv;
if (p->frame)
talloc_free(p->frame);
@@ -322,6 +323,9 @@ static int preinit(struct vo *vo)
memcpy(p->lut[i].str, buff, 4); // some strings may not end on a null byte, but that's ok.
}
+ printf(ESC_HIDE_CURSOR);
+ printf(ESC_SAVE_SCREEN);
+
return 0;
}