mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-28 01:40:17 -05:00
commit
f930de65ef
2 changed files with 19 additions and 3 deletions
|
|
@ -84,6 +84,8 @@
|
||||||
* Memory leak triggered by “opening” an OSC-8 URI and then resetting
|
* Memory leak triggered by “opening” an OSC-8 URI and then resetting
|
||||||
the terminal without closing the URI
|
the terminal without closing the URI
|
||||||
(https://codeberg.org/dnkl/foot/issues/495).
|
(https://codeberg.org/dnkl/foot/issues/495).
|
||||||
|
* Assertion when emitting a sixel occupying the entire scrollback
|
||||||
|
history (https://codeberg.org/dnkl/foot/issues/494).
|
||||||
|
|
||||||
|
|
||||||
### Security
|
### Security
|
||||||
|
|
|
||||||
20
sixel.c
20
sixel.c
|
|
@ -761,14 +761,28 @@ sixel_unhook(struct terminal *term)
|
||||||
int start_row = do_scroll ? term->grid->cursor.point.row : 0;
|
int start_row = do_scroll ? term->grid->cursor.point.row : 0;
|
||||||
const int start_col = do_scroll ? term->grid->cursor.point.col : 0;
|
const int start_col = do_scroll ? term->grid->cursor.point.col : 0;
|
||||||
|
|
||||||
if (pixel_rows_left == 0 || rows_avail == 0) {
|
/* Total number of rows needed by image (+ optional newline at the end) */
|
||||||
|
const int rows_needed =
|
||||||
|
(term->sixel.image.height + term->cell_height - 1) / term->cell_height +
|
||||||
|
(term->sixel.cursor_right_of_graphics ? 0 : 1);
|
||||||
|
|
||||||
|
/* Will we be emitting anything at all? */
|
||||||
|
const bool no_emission =
|
||||||
|
rows_needed > term->grid->num_rows ||
|
||||||
|
pixel_rows_left == 0 ||
|
||||||
|
rows_avail == 0;
|
||||||
|
|
||||||
|
if (no_emission) {
|
||||||
/* We won’t be emitting any sixels - free backing image */
|
/* We won’t be emitting any sixels - free backing image */
|
||||||
free(term->sixel.image.data);
|
free(term->sixel.image.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We do not allow sixels to cross the scrollback wrap-around, as
|
/* We do not allow sixels to cross the scrollback wrap-around, as
|
||||||
* this makes intersection calculations much more complicated */
|
* this makes intersection calculations much more complicated */
|
||||||
while (pixel_rows_left > 0 && rows_avail > 0) {
|
while (pixel_rows_left > 0 &&
|
||||||
|
rows_avail > 0 &&
|
||||||
|
rows_needed <= term->grid->num_rows)
|
||||||
|
{
|
||||||
const int cur_row = (term->grid->offset + start_row) & (term->grid->num_rows - 1);
|
const int cur_row = (term->grid->offset + start_row) & (term->grid->num_rows - 1);
|
||||||
const int rows_left_until_wrap_around = term->grid->num_rows - cur_row;
|
const int rows_left_until_wrap_around = term->grid->num_rows - cur_row;
|
||||||
const int usable_rows = min(rows_avail, rows_left_until_wrap_around);
|
const int usable_rows = min(rows_avail, rows_left_until_wrap_around);
|
||||||
|
|
@ -799,7 +813,7 @@ sixel_unhook(struct terminal *term)
|
||||||
.opaque = !term->sixel.transparent_bg,
|
.opaque = !term->sixel.transparent_bg,
|
||||||
};
|
};
|
||||||
|
|
||||||
xassert(image.rows < term->grid->num_rows);
|
xassert(image.rows <= term->grid->num_rows);
|
||||||
xassert(image.pos.row + image.rows - 1 < term->grid->num_rows);
|
xassert(image.pos.row + image.rows - 1 < term->grid->num_rows);
|
||||||
|
|
||||||
LOG_DBG("generating %dx%d pixman image at %d-%d",
|
LOG_DBG("generating %dx%d pixman image at %d-%d",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue