From 8f5e6e85e0401a0071814c6dac7f16adb3b0b6e4 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Mon, 29 Jun 2020 21:53:29 +0200 Subject: sixel: destroy all sixels when font size is decreased If changing the font size causes the cell size to decrease, either horizontally or vertically (or both), then delete all sixels since the grid space they allocated no longer is enough to hold the images. --- sixel.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'sixel.c') diff --git a/sixel.c b/sixel.c index a4b27416..80ac3843 100644 --- a/sixel.c +++ b/sixel.c @@ -66,6 +66,17 @@ sixel_destroy(struct sixel *sixel) sixel->data = NULL; } +void +sixel_destroy_all(struct terminal *term) +{ + tll_foreach(term->normal.sixel_images, it) + sixel_destroy(&it->item); + tll_foreach(term->alt.sixel_images, it) + sixel_destroy(&it->item); + tll_free(term->normal.sixel_images); + tll_free(term->alt.sixel_images); +} + static void sixel_erase(struct terminal *term, struct sixel *sixel) { -- cgit v1.3