Fix incorrect row being detected under mouse when pixel scroll is non-zero

This commit is contained in:
Kovid Goyal 2026-01-22 12:10:36 +05:30
parent 391b9c9c80
commit 82d3364e4a
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

View file

@ -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;