From 7f48a927deabd3baeedba0ae9495d0480b557979 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 6 Aug 2020 19:05:58 +0530 Subject: [PATCH] Fix image leaving behind a black rectangle when switching away and back to alternate screen layer_dirty was being reset if remove_images was called more than once without an intervening call to update_layers. Fixes #2901 --- docs/changelog.rst | 3 +++ kitty/graphics.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 9486d4a0a..4b186fa19 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -16,6 +16,9 @@ To update |kitty|, :doc:`follow the instructions `. - Adjust cell height automatically for buggy fonts that draw brackets outside the bounding box +- Fix image leaving behind a black rectangle when switch away and back to + alternate screen (:iss:`2901`) + 0.18.2 [2020-07-28] -------------------- diff --git a/kitty/graphics.c b/kitty/graphics.c index 809d868b8..2150d2c82 100644 --- a/kitty/graphics.c +++ b/kitty/graphics.c @@ -646,7 +646,7 @@ grman_update_layers(GraphicsManager *self, unsigned int scrolled_by, float scree static inline void filter_refs(GraphicsManager *self, const void* data, bool free_images, bool (*filter_func)(ImageRef*, Image*, const void*, CellPixelSize), CellPixelSize cell) { - self->layers_dirty = self->image_count > 0; + if (self->image_count) self->layers_dirty = true; for (size_t i = self->image_count; i-- > 0;) { Image *img = self->images + i; for (size_t j = img->refcnt; j-- > 0;) {