mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
render: sixel: regression: need to take current offset into account when early-quitting sixel rendering
The sixel images are sorted, that's true. But in order for our row numer comparisons to actually work, we need to rebase all numbers against the current scrollback offset (or, the scrollback *end*, to be precise).
This commit is contained in:
parent
4006fc86e4
commit
c7b2dcc0f4
1 changed files with 18 additions and 8 deletions
26
render.c
26
render.c
|
|
@ -795,20 +795,30 @@ render_sixel(struct terminal *term, pixman_image_t *pix,
|
|||
static void
|
||||
render_sixel_images(struct terminal *term, pixman_image_t *pix)
|
||||
{
|
||||
const int view_start = term->grid->view;
|
||||
const int view_end = view_start + term->rows;
|
||||
if (likely(tll_length(term->grid->sixel_images)) == 0)
|
||||
return;
|
||||
|
||||
LOG_DBG("SIXELS: %zu images, view=%d-%d",
|
||||
tll_length(term->grid->sixel_images), view_start, view_end);
|
||||
const int scrollback_end
|
||||
= (term->grid->offset + term->rows) & (term->grid->num_rows - 1);
|
||||
|
||||
const int view_start
|
||||
= (term->grid->view
|
||||
- scrollback_end
|
||||
+ term->grid->num_rows) & (term->grid->num_rows - 1);
|
||||
|
||||
const int view_end = view_start + term->rows - 1;
|
||||
|
||||
//LOG_DBG("SIXELS: %zu images, view=%d-%d",
|
||||
// tll_length(term->grid->sixel_images), view_start, view_end);
|
||||
|
||||
tll_foreach(term->grid->sixel_images, it) {
|
||||
const struct sixel *six = &it->item;
|
||||
const int start = six->pos.row;
|
||||
const int start
|
||||
= (six->pos.row
|
||||
- scrollback_end
|
||||
+ term->grid->num_rows) & (term->grid->num_rows - 1);
|
||||
const int end = start + six->rows - 1;
|
||||
|
||||
/* Sixels aren't allowed to cross the wrap-around */
|
||||
assert(end < term->grid->num_rows);
|
||||
|
||||
//LOG_DBG(" sixel: %d-%d", start, end);
|
||||
if (start > view_end) {
|
||||
/* Sixel starts after view ends, no need to try to render it */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue