mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-04 04:06:06 -05:00
sixel: reflow: drop sixels that crosses the scrollback history’s end
This fixes various crashes that occurred after a reflow due to the sixel image list invariants no longer being true.
This commit is contained in:
parent
d54adc5263
commit
d0c5cf6e9f
1 changed files with 23 additions and 0 deletions
23
sixel.c
23
sixel.c
|
|
@ -643,6 +643,29 @@ sixel_reflow(struct terminal *term)
|
|||
continue;
|
||||
}
|
||||
|
||||
/* Drop sixels that now cross the current scrollback end
|
||||
* border. This is similar to a sixel that have been
|
||||
* scrolled out */
|
||||
/* TODO: should be possible to optimize this */
|
||||
bool sixel_destroyed = false;
|
||||
int last_row = -1;
|
||||
|
||||
for (int j = 0; j < six->rows; j++) {
|
||||
int row_no = rebase_row(term, six->pos.row + j);
|
||||
if (last_row != -1 && last_row >= row_no) {
|
||||
sixel_destroy(six);
|
||||
sixel_destroyed = true;
|
||||
break;
|
||||
}
|
||||
|
||||
last_row = row_no;
|
||||
}
|
||||
|
||||
if (sixel_destroyed) {
|
||||
LOG_WARN("destroyed sixel that now crossed history");
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Sixels that didn’t overlap may now do so, which isn’t
|
||||
* allowed of course */
|
||||
_sixel_overwrite_by_rectangle(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue