diff options
author | Mia Herkt <mia@0x0.st> | 2022-12-17 05:31:16 +0100 |
---|---|---|
committer | mia <652892+mia-0@users.noreply.github.com> | 2022-12-19 13:48:49 +0100 |
commit | 4e1626a21c6a2efbcd333adeacfcea42ebd7f43d (patch) | |
tree | c26a119a237aeca6d791dd9d4e6da6a1442cd950 /video/out | |
parent | 1564e4f29fb7a2094e0b24899fad91838b569a42 (diff) | |
download | mpv-4e1626a21c6a2efbcd333adeacfcea42ebd7f43d.tar.bz2 mpv-4e1626a21c6a2efbcd333adeacfcea42ebd7f43d.tar.xz |
vo_sixel: Use the alternate buffer to restore term
Diffstat (limited to 'video/out')
-rw-r--r-- | video/out/vo_sixel.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/video/out/vo_sixel.c b/video/out/vo_sixel.c index c9cc1573cb..4e1c8c8321 100644 --- a/video/out/vo_sixel.c +++ b/video/out/vo_sixel.c @@ -44,6 +44,8 @@ #define ESC_HIDE_CURSOR "\033[?25l" #define ESC_RESTORE_CURSOR "\033[?25h" +#define ESC_SAVE_SCREEN "\033[?1049h" +#define ESC_RESTORE_SCREEN "\033[?1049l" #define ESC_CLEAR_SCREEN "\033[2J" #define ESC_GOTOXY "\033[%d;%df" #define ESC_USE_GLOBAL_COLOR_REG "\033[?1070l" @@ -468,6 +470,8 @@ static int preinit(struct vo *vo) sixel_output_set_encode_policy(priv->output, SIXEL_ENCODEPOLICY_FAST); + if (priv->opt_clear) + printf(ESC_SAVE_SCREEN); printf(ESC_HIDE_CURSOR); /* don't use private color registers for each frame. */ @@ -509,10 +513,8 @@ static void uninit(struct vo *vo) printf(ESC_RESTORE_CURSOR); - if (priv->opt_clear) { - printf(ESC_CLEAR_SCREEN); - printf(ESC_GOTOXY, 1, 1); - } + if (priv->opt_clear) + printf(ESC_RESTORE_SCREEN); fflush(stdout); if (priv->output) { |