From deb61d20d82bdfc45af2aa51786fa500e53b84bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Sat, 27 Jun 2020 20:16:39 +0200 Subject: [PATCH] grid: reflow: delete sixels that end up crossing the scrollback wrap around Our sixel handling code requires sixels to *not* cross the scrollback wrap around. Until we've fixes the reflow code that split up such sixels (much like we do when we generate a sixel), simply delete it. --- grid.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/grid.c b/grid.c index ee10f38b..d1d625c6 100644 --- a/grid.c +++ b/grid.c @@ -123,11 +123,12 @@ grid_reflow(struct grid *grid, int new_rows, int new_cols, struct sixel six = it->item; six.pos.row = new_row_idx; - /* TODO: ensure sixels don't span across the wrap-around */ - int end __attribute__((unused)) = (six.pos.row + six.rows - 1) & (new_rows - 1); - assert(end >= six.pos.row); - - tll_push_back(new_sixels, six); + int end = (six.pos.row + six.rows - 1) & (new_rows - 1); + if (end < six.pos.row) { + /* TODO: split sixel instead of removing it... */ + sixel_destroy(&it->item); + } else + tll_push_back(new_sixels, six); tll_remove(grid->sixel_images, it); } }