From 197fa00448019c62bae4a9cde9efec068c8398fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Michaj=C5=82ow?= Date: Sat, 10 Oct 2026 23:47:01 +0200 Subject: [PATCH] vo_tct: place the image from row 1 and park the cursor below it The indexing suppose to be from 1,1, not 0,0. So we were off by one and clamped by the terminal to the edge, but that left empty row and column, and also cleared status line. --- video/out/vo_tct.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/video/out/vo_tct.c b/video/out/vo_tct.c index 54ed8e56ca..792c996b73 100644 --- a/video/out/vo_tct.c +++ b/video/out/vo_tct.c @@ -137,7 +137,7 @@ static void write_plain(bstr *frame, const int ty = (dheight - sheight) / 2; for (int y = 0; y < sheight; y++) { const unsigned char *row = source + y * source_stride; - bstr_xappend_asprintf(NULL, frame, TERM_ESC_GOTO_YX, ty + y, tx); + bstr_xappend_asprintf(NULL, frame, TERM_ESC_GOTO_YX, ty + y + 1, tx + 1); for (int x = 0; x < swidth; x++) { unsigned char b = *row++; unsigned char g = *row++; @@ -165,7 +165,7 @@ static void write_half_blocks(bstr *frame, for (int y = 0; y < sheight * 2; y += 2) { const unsigned char *row_up = source + y * source_stride; const unsigned char *row_down = source + (y + 1) * source_stride; - bstr_xappend_asprintf(NULL, frame, TERM_ESC_GOTO_YX, ty + y / 2, tx); + bstr_xappend_asprintf(NULL, frame, TERM_ESC_GOTO_YX, ty + y / 2 + 1, tx + 1); for (int x = 0; x < swidth; x++) { unsigned char b_up = *row_up++; unsigned char g_up = *row_up++; @@ -197,6 +197,8 @@ static void get_win_size(struct vo *vo, int *out_width, int *out_height) { *out_width = p->opts.width; if (p->opts.height > 0) *out_height = p->opts.height; + // The bottom row is left to the status line. + *out_height = MPMAX(*out_height - 1, 1); } static int reconfig(struct vo *vo, struct mp_image_params *params) @@ -275,7 +277,7 @@ static void flip_page(struct vo *vo) p->frame->planes[0], p->frame->stride[0], p->opts.term256, p->lut); } - bstr_xappend0(NULL, out, "\n"); + bstr_xappend_asprintf(NULL, out, TERM_ESC_GOTO_YX, vo->dheight + 1, 1); bstr_xappend0(NULL, out, TERM_ESC_SYNC_UPDATE_END); terminal_swapchain_present(p->swapchain, out); }