From 23d39e6f90bf57a4690f18312f32ef99eb665774 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Sat, 22 Feb 2020 11:52:48 +0100 Subject: [PATCH] sixel: finalize: use width/height from image, not row/col pos --- sixel.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/sixel.c b/sixel.c index f7966b80..7da45ec5 100644 --- a/sixel.c +++ b/sixel.c @@ -57,16 +57,11 @@ sixel_unhook(struct terminal *term) free(term->sixel.palette); term->sixel.palette = NULL; - if (term->sixel.pos.col > term->sixel.max_col) - term->sixel.max_col = term->sixel.pos.col; - term->sixel.pos.row++; - term->sixel.pos.col = 0; - struct sixel image = { .data = term->sixel.image.data, - .width = term->sixel.max_col, - .height = term->sixel.pos.row * 6, - .rows = (term->sixel.pos.row * 6 + term->cell_height - 1) / term->cell_height, + .width = term->sixel.image.width, + .height = term->sixel.image.height, + .rows = (term->sixel.image.height + term->cell_height - 1) / term->cell_height, .pos = (struct coord){term->cursor.point.col, term->grid->offset + term->cursor.point.row}, }; @@ -93,8 +88,7 @@ sixel_unhook(struct terminal *term) term->sixel.max_col = 0; term->sixel.pos = (struct coord){0, 0}; - const size_t lines = (image.height + term->cell_height - 1) / term->cell_height; - for (size_t i = 0; i < lines; i++) + for (size_t i = 0; i < image.rows; i++) term_linefeed(term); term_formfeed(term); render_refresh(term);