mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-13 04:27:47 -05:00
sixel: overwrite_by_row: handle case where 'width' goes past end of row
Cap 'width' to maximum number of columns available.
This commit is contained in:
parent
b1214bf635
commit
3063204289
1 changed files with 4 additions and 1 deletions
5
sixel.c
5
sixel.c
|
|
@ -367,11 +367,14 @@ sixel_overwrite_by_row(struct terminal *term, int _row, int col, int width)
|
|||
assert(_row >= 0);
|
||||
assert(_row < term->rows);
|
||||
assert(col >= 0);
|
||||
assert(col + width <= term->grid->num_cols);
|
||||
assert(col < term->grid->num_cols);
|
||||
|
||||
if (likely(tll_length(term->grid->sixel_images) == 0))
|
||||
return;
|
||||
|
||||
if (col + width > term->grid->num_cols)
|
||||
width = term->grid->num_cols - col;
|
||||
|
||||
const int row = (term->grid->offset + _row) & (term->grid->num_rows - 1);
|
||||
const int scrollback_rel_row = rebase_row(term, row);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue