From 82d3364e4a5133496eceb92670bc50ccb7660f45 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 22 Jan 2026 12:10:36 +0530 Subject: [PATCH] Fix incorrect row being detected under mouse when pixel scroll is non-zero --- kitty/mouse.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kitty/mouse.c b/kitty/mouse.c index 3f3676816..05575a568 100644 --- a/kitty/mouse.c +++ b/kitty/mouse.c @@ -291,7 +291,9 @@ cell_for_pos(Window *w, unsigned int *x, unsigned int *y, bool *in_left_half_of_ in_left_half = (xval - fxval <= 0.5) ? true : false; } if (mouse_y >= g->bottom) qy = screen->lines - 1; - else if (mouse_y >= g->top) qy = (unsigned int)((double)(mouse_y - g->top) / os_window->fonts_data->fcm.cell_height); + else if (mouse_y >= g->top) { + qy = (unsigned int)((double)(mouse_y - g->top - screen->pixel_scroll_offset_y) / os_window->fonts_data->fcm.cell_height); + } if (qx < screen->columns && qy < screen->lines) { *x = qx; *y = qy; *in_left_half_of_cell = in_left_half;