mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
sixel: overwrite-by-rectangle: assert sixels don’t cross scrollback wrap-around
This commit is contained in:
parent
8168fc19df
commit
675f3e56c8
1 changed files with 7 additions and 4 deletions
11
sixel.c
11
sixel.c
|
|
@ -372,23 +372,26 @@ _sixel_overwrite_by_rectangle(
|
|||
const int start = row;
|
||||
const int end = row + height - 1;
|
||||
|
||||
/* We should never generate scrollback wrapping sixels */
|
||||
assert(end < term->grid->num_rows);
|
||||
|
||||
const int scrollback_rel_start = rebase_row(term, start);
|
||||
|
||||
tll_foreach(term->grid->sixel_images, it) {
|
||||
struct sixel *six = &it->item;
|
||||
|
||||
const int six_start = six->pos.row;
|
||||
const int six_end = (six_start + six->rows - 1) & (term->grid->num_rows - 1);
|
||||
const int six_end = (six_start + six->rows - 1);
|
||||
const int six_scrollback_rel_end = rebase_row(term, six_end);
|
||||
|
||||
/* We should never generate scrollback wrapping sixels */
|
||||
assert(six_end < term->grid->num_rows);
|
||||
|
||||
if (six_scrollback_rel_end < scrollback_rel_start) {
|
||||
/* All remaining sixels are *before* our rectangle */
|
||||
break;
|
||||
}
|
||||
|
||||
/* We should never generate scrollback wrapping sixels */
|
||||
assert(six_end >= six_start);
|
||||
|
||||
if ((start <= six_start && end >= six_start) || /* Crosses sixel start boundary */
|
||||
(start <= six_end && end >= six_end) || /* Crosses sixel end boundary */
|
||||
(start >= six_start && end <= six_end)) /* Fully within sixel range */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue