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:
Daniel Eklöf 2020-10-05 18:33:50 +02:00
parent 2c952761f2
commit 468add5591
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

23
sixel.c
View file

@ -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 didnt overlap may now do so, which isnt
* allowed of course */
_sixel_overwrite_by_rectangle(