multi-cursor: refactor: add function for dirtying/damaging all multi-cursors

This commit is contained in:
Daniel Eklöf 2025-08-31 10:25:17 +02:00
parent 4f89c461b1
commit 265c93c4c4
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
3 changed files with 32 additions and 47 deletions

View file

@ -2567,6 +2567,29 @@ term_damage_cursor(struct terminal *term)
term->grid->cur_row->dirty = true;
}
void
term_damage_all_multi_cursors(struct terminal *term)
{
if (likely(term->multi_cursor.shapes == NULL))
return;
int rect_count = 0;
const pixman_box32_t *boxes =
pixman_region32_rectangles(&term->multi_cursor.active, &rect_count);
for (const pixman_box32_t *box = boxes; box < &boxes[rect_count]; box++) {
for (int r = box->y1; r < box->y2; r++) {
struct row *row = grid_row(term->grid, r);
xassert(row != NULL);
row->dirty = true;
for (struct cell *c = &row->cells[box->x1]; c < &row->cells[box->x2]; c++)
c->attrs.clean = false;
}
}
}
void
term_damage_margins(struct terminal *term)
{