aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2025-08-27 13:00:27 +0000
committerDaniel Eklöf <daniel@ekloef.se>2025-08-27 13:00:27 +0000
commitd5e99862afd2802993339953210ddb2dd8baf62b (patch)
tree26ad6389a69461aefe7ffc37dc26c3757a5d2a62
parentmulti-cursor: dirty affected rows and cells (diff)
multi-cursor: wip: render extra cursors
Currently ignores custom shapes and colors (i.e. all extra cursors are rendered exactly as the primary cursor).
-rw-r--r--render.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/render.c b/render.c
index 822df686..80dfcd93 100644
--- a/render.c
+++ b/render.c
@@ -1190,8 +1190,26 @@ render_row(struct terminal *term, pixman_image_t *pix,
pixman_region32_t *damage, struct row *row,
int row_no, int cursor_col)
{
- for (int col = term->cols - 1; col >= 0; col--)
- render_cell(term, pix, damage, row, row_no, col, cursor_col == col);
+ if (likely(pixman_region32_empty(&term->multi_cursor.active))) {
+ for (int col = term->cols - 1; col >= 0; col--)
+ render_cell(term, pix, damage, row, row_no, col, cursor_col == col);
+ } else {
+ //enum multi_cursor_shape *extra_cursor = NULL;
+ for (int col = term->cols - 1; col >= 0; col--) {
+ pixman_region32_t match;
+ pixman_region32_init(&match);
+ pixman_region32_intersect_rect(&match, &term->multi_cursor.active, col, row_no, 1, 1);
+
+ const bool is_extra_cursor = pixman_region32_not_empty(&match);
+
+ if (is_extra_cursor) {
+ LOG_WARN("row=%d, col=%d, is-extra-cursor, shape=%d", row_no, col, term->multi_cursor.shapes[row_no * term->cols + col]);
+ xassert(term->multi_cursor.shapes[row_no * term->cols + col] != MULTI_CURSOR_SHAPE_NONE);
+ }
+
+ render_cell(term, pix, damage, row, row_no, col, cursor_col == col || is_extra_cursor);
+ }
+ }
}
static void