mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
term: scroll: call sixel_delete_*() instead of manually erasing sixel images
This commit is contained in:
parent
4c6f2ea340
commit
77fcb43ea5
1 changed files with 4 additions and 35 deletions
39
terminal.c
39
terminal.c
|
|
@ -1534,27 +1534,12 @@ term_scroll_partial(struct terminal *term, struct scroll_region region, int rows
|
|||
/* Erase scrolled in lines */
|
||||
for (int r = max(region.end - rows, region.start); r < region.end; r++) {
|
||||
erase_line(term, grid_row_and_alloc(term->grid, r));
|
||||
//sixel_delete_at_row(term, r);
|
||||
if (selection_on_row_in_view(term, r))
|
||||
selection_cancel(term);
|
||||
|
||||
|
||||
tll_foreach(term->sixel_images, it) {
|
||||
if (it->item.grid != term->grid)
|
||||
continue;
|
||||
|
||||
/* Make it simple - remove the entire image if it starts
|
||||
* getting scrolled out */
|
||||
|
||||
int img_top_row = it->item.pos.row & (term->grid->num_rows - 1);
|
||||
int new_row = (term->grid->offset + r) & (term->grid->num_rows - 1);
|
||||
|
||||
if (img_top_row == new_row) {
|
||||
sixel_destroy(&it->item);
|
||||
tll_remove(term->sixel_images, it);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sixel_delete_in_range(term, max(region.end - rows, region.start), region.end - 1);
|
||||
term_damage_scroll(term, DAMAGE_SCROLL, region, rows);
|
||||
term->grid->cur_row = grid_row(term->grid, term->cursor.point.row);
|
||||
}
|
||||
|
|
@ -1602,28 +1587,12 @@ term_scroll_reverse_partial(struct terminal *term,
|
|||
/* Erase scrolled in lines */
|
||||
for (int r = region.start; r < min(region.start + rows, region.end); r++) {
|
||||
erase_line(term, grid_row_and_alloc(term->grid, r));
|
||||
//sixel_delete_at_row(term, r);
|
||||
if (selection_on_row_in_view(term, r))
|
||||
selection_cancel(term);
|
||||
|
||||
tll_foreach(term->sixel_images, it) {
|
||||
if (it->item.grid != term->grid)
|
||||
continue;
|
||||
|
||||
/* Make it simple - remove the entire image if it starts
|
||||
* getting scrolled out */
|
||||
|
||||
/* TODO: untested */
|
||||
|
||||
int img_bottom_row = (it->item.pos.row + it->item.rows) & (term->grid->num_rows - 1);
|
||||
int new_row = (term->grid->offset + r) & (term->grid->num_rows - 1);
|
||||
|
||||
if (img_bottom_row == new_row) {
|
||||
sixel_destroy(&it->item);
|
||||
tll_remove(term->sixel_images, it);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sixel_delete_in_range(term, region.start, min(region.start + rows, region.end) - 1);
|
||||
term_damage_scroll(term, DAMAGE_SCROLL_REVERSE, region, rows);
|
||||
term->grid->cur_row = grid_row(term->grid, term->cursor.point.row);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue