mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-21 01:40:16 -05:00
grid: grid_resize_without_reflow: transfer URI ranges
This commit is contained in:
parent
3ca5a65c33
commit
8da82c897b
1 changed files with 21 additions and 1 deletions
22
grid.c
22
grid.c
|
|
@ -114,6 +114,27 @@ grid_resize_without_reflow(
|
|||
sixel_destroy(&it->item);
|
||||
tll_remove(untranslated_sixels, it);
|
||||
}
|
||||
|
||||
/* Copy URI ranges, truncating them if necessary */
|
||||
if (old_row->extra == NULL)
|
||||
continue;
|
||||
|
||||
new_row->extra = xcalloc(1, sizeof(*new_row->extra));
|
||||
tll_foreach(old_row->extra->uri_ranges, it) {
|
||||
if (it->item.start >= new_rows) {
|
||||
/* The whole range is truncated */
|
||||
continue;
|
||||
}
|
||||
|
||||
struct row_uri_range range = {
|
||||
.start = it->item.start,
|
||||
.end = min(it->item.end, new_cols - 1),
|
||||
.id = it->item.id,
|
||||
.uri = xstrdup(it->item.uri),
|
||||
};
|
||||
|
||||
tll_push_back(new_row->extra->uri_ranges, range);
|
||||
}
|
||||
}
|
||||
|
||||
/* Clear "new" lines */
|
||||
|
|
@ -122,7 +143,6 @@ grid_resize_without_reflow(
|
|||
new_grid[(new_offset + r) & (new_rows - 1)] = new_row;
|
||||
|
||||
memset(new_row->cells, 0, sizeof(struct cell) * new_cols);
|
||||
new_row->linebreak = false;
|
||||
new_row->dirty = true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue