Skip to content

Commit 992be37

Browse files
committed
fix unclamped-by-line token ranges in code slice widget mouse -> token path
1 parent 4727a01 commit 992be37

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/raddbg/raddbg_widgets.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1770,7 +1770,8 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
17701770
TXT_Token *line_token = &line_tokens->v[line_token_idx];
17711771
if(contains_1u64(line_token->range, mouse_pt_off))
17721772
{
1773-
mouse_token_rng = txt_rng(txt_pt(mouse_pt.line, 1+line_token->range.min-line_range.min), txt_pt(mouse_pt.line, 1+line_token->range.max-line_range.min));
1773+
Rng1U64 line_token_range_clamped = intersect_1u64(line_token->range, line_range);
1774+
mouse_token_rng = txt_rng(txt_pt(mouse_pt.line, 1+line_token_range_clamped.min-line_range.min), txt_pt(mouse_pt.line, 1+line_token_range_clamped.max-line_range.min));
17741775
break;
17751776
}
17761777
}

0 commit comments

Comments
 (0)