diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2020-10-05 16:33:50 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2020-10-11 17:26:09 +0000 |
| commit | d0c5cf6e9fa3c7f85531cfc3d3166c2cf7b6707e (patch) | |
| tree | 06cb4321c7af76017e95347f4b3df6c07f3c19d2 | |
| parent | sixel: unhook: do overwrite *after* linefeeding (diff) | |
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.
| -rw-r--r-- | sixel.c | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -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( |
