Skip to content

Commit

Permalink
Fix bug in origin location computation.
Browse files Browse the repository at this point in the history
In particular the second "<=" is wrong, it should be "<", since ranges are end-exclusive. For clarity just replace it with Range::contains.
  • Loading branch information
KarelPeeters committed Oct 13, 2024
1 parent 347ee78 commit d8c868f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/renderer/display_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1149,7 +1149,7 @@ fn format_header<'a>(
..
} = item
{
if main_range >= range.0 && main_range <= range.1 + end_line.len() {
if (range.0..range.1 + end_line.len()).contains(&main_range) {
let char_column = text[0..(main_range - range.0).min(text.len())]
.chars()
.count();
Expand Down

0 comments on commit d8c868f

Please sign in to comment.