From 265c93c4c4199fa131476fdbd9eacb9d2fcf51c6 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sun, 31 Aug 2025 10:25:17 +0200 Subject: multi-cursor: refactor: add function for dirtying/damaging all multi-cursors --- terminal.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'terminal.c') diff --git a/terminal.c b/terminal.c index fe21cfd2..e8a25061 100644 --- a/terminal.c +++ b/terminal.c @@ -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) { -- cgit v1.3