From 74c7373efcfe1d86a273b58a3e87559a88865e53 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sun, 4 Oct 2020 13:09:24 +0200 Subject: sixel: add sixel_cell_size_changed() This function should be called *after* the cell dimensions have changed, but *before* resizing/reflowing the grids. --- sixel.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'sixel.c') diff --git a/sixel.c b/sixel.c index 9cec4f62..110c8ab5 100644 --- a/sixel.c +++ b/sixel.c @@ -484,6 +484,30 @@ sixel_overwrite_at_cursor(struct terminal *term, int width) term, term->grid->cursor.point.row, term->grid->cursor.point.col, width); } +void +sixel_cell_size_changed(struct terminal *term) +{ + struct grid *g = term->grid; + + term->grid = &term->normal; + 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; + } + verify_sixels(term); + + term->grid = &term->alt; + 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; + } + verify_sixels(term); + + term->grid = g; +} + void sixel_unhook(struct terminal *term) { -- cgit v1.3