From 9cccc76520a3eac3957d22bf9becd68d378521cf Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sat, 3 Oct 2020 22:41:20 +0200 Subject: term: re-calculate sixel images’ rows/cols values when cell size changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- terminal.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/terminal.c b/terminal.c index 0840a45c..a34ecb1a 100644 --- a/terminal.c +++ b/terminal.c @@ -1524,6 +1524,20 @@ term_font_size_adjust(struct terminal *term, double amount) * So we delete them. */ sixel_destroy_all(term); + } else if (term->cell_width != old_cell_width || + term->cell_height != old_cell_height) + { + tll_foreach(term->normal.sixel_images, it) { + struct sixel *six = &it->item; + six->rows = (six->height + term->cell_height - 1) / term->cell_height; + six->cols = (six->width + term->cell_width - 1) / term->cell_width; + } + + tll_foreach(term->alt.sixel_images, it) { + struct sixel *six = &it->item; + six->rows = (six->height + term->cell_height - 1) / term->cell_height; + six->cols = (six->width + term->cell_width - 1) / term->cell_width; + } } return true; } -- cgit v1.3