vo_sixel: Add fallback terminal width and height

In case terminal_get_size function fails, the
default height of 25 rows and 80 columns will be assumed
This commit is contained in:
Shreesh Adiga 2020-11-09 20:04:56 +05:30 committed by Avi Halachmi (:avih)
parent baf45b3bc9
commit fd48f0bcb2
1 changed files with 5 additions and 2 deletions

View File

@ -38,6 +38,9 @@
#define IMGFMT IMGFMT_RGB24
#define TERMINAL_FALLBACK_DEFAULT_WIDTH 80
#define TERMINAL_FALLBACK_DEFAULT_HEIGHT 25
#define ESC_HIDE_CURSOR "\033[?25l"
#define ESC_RESTORE_CURSOR "\033[?25h"
#define ESC_CLEAR_SCREEN "\033[2J"
@ -82,8 +85,8 @@ static void validate_offset_values(struct vo* vo)
struct priv* priv = vo->priv;
int top = priv->top;
int left = priv->left;
int terminal_width = 0;
int terminal_height = 0;
int terminal_width = TERMINAL_FALLBACK_DEFAULT_WIDTH;
int terminal_height = TERMINAL_FALLBACK_DEFAULT_HEIGHT;
terminal_get_size(&terminal_width, &terminal_height);