diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2025-08-28 05:34:21 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2025-08-28 05:34:21 +0000 |
| commit | dcabe14392a01fe97836fa5c6fb059c4b83124d3 (patch) | |
| tree | 2f06f9d285ac63fa9ca26079609bca2f35942ef9 | |
| parent | multi-cursor: render: wip (diff) | |
render: multi-cell: decrement 'extra-cursor' pointer instead of indexing
| -rw-r--r-- | render.c | 18 |
1 files changed, 11 insertions, 7 deletions
@@ -1272,15 +1272,19 @@ render_row(struct terminal *term, pixman_image_t *pix, pixman_region32_t *damage, struct row *row, int row_no, int cursor_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, MULTI_CURSOR_SHAPE_NONE); + if (likely(term->multi_cursor.shapes == NULL)) { + for (int col = term->cols - 1; col >= 0; col--) { + render_cell(term, pix, damage, row, row_no, col, + cursor_col == col, MULTI_CURSOR_SHAPE_NONE); + } } else { - xassert(term->multi_cursor.shapes != NULL); + enum multi_cursor_shape *extra_cursors = + &term->multi_cursor.shapes[row_no * term->cols + term->cols - 1]; - enum multi_cursor_shape *extra_cursors = &term->multi_cursor.shapes[row_no * term->cols]; - for (int col = term->cols - 1; col >= 0; col--) - render_cell(term, pix, damage, row, row_no, col, cursor_col == col, extra_cursors[col]); + for (int col = term->cols - 1; col >= 0; col--, extra_cursors--) { + render_cell(term, pix, damage, row, row_no, col, + cursor_col == col, *extra_cursors); + } } } |
