From 81722ebbaca21dfdeb021a4df55aa1fee91cefef Mon Sep 17 00:00:00 2001 From: Ryan Fleury Date: Mon, 27 Jul 2026 14:46:00 -0700 Subject: [PATCH] fix oob mouse -> line path --- src/raddbg/raddbg_widgets.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/raddbg/raddbg_widgets.c b/src/raddbg/raddbg_widgets.c index 5d3ed676..348a2a90 100644 --- a/src/raddbg/raddbg_widgets.c +++ b/src/raddbg/raddbg_widgets.c @@ -1982,7 +1982,9 @@ rd_code_slice(RD_CodeSliceParams *params, U64 *cursor, U64 *mark, S64 *preferred Vec2F32 mouse = ui_mouse(); // rjf: mouse y => index - mouse_y_line_idx = (U64)((mouse.y - text_container_box->rect.y0) / params->line_height_px); + S64 mouse_y_line_idx_signed = ((mouse.y - text_container_box->rect.y0) / params->line_height_px); + mouse_y_line_idx_signed = Clamp(0, mouse_y_line_idx_signed, dim_1s64(params->line_num_range)-1); + mouse_y_line_idx = (U64)mouse_y_line_idx_signed; // rjf: index => line num S64 line_num = (params->line_num_range.min + mouse_y_line_idx);