Skip to content

Commit 6af01c8

Browse files
committed
Fix another bounds-checking bug
1 parent 4263225 commit 6af01c8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/frontend.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,10 +370,11 @@ void redraw_canvas_win() {
370370
*/
371371
void draw_collab_cursors(collab_list_t *collab_list) {
372372
collab_t *c = NULL;
373+
// calculate visible bounds (in canvas coordinates)
373374
const int min_x = view->x;
374375
const int min_y = view->y;
375-
const int max_x = min(view_max_x, view->canvas->num_cols - view->x);
376-
const int max_y = min(view_max_y, view->canvas->num_rows - view->y);
376+
const int max_x = min(view->canvas->num_cols, view->x + view_max_x) - 1;
377+
const int max_y = min(view->canvas->num_rows, view->y + view_max_y) - 1;
377378
for (int i = 0; i < collab_list->len; i++) {
378379
c = collab_list->list[i];
379380
// only draw cursors that exist and are visible on the screen

0 commit comments

Comments
 (0)