Skip to content

Commit

Permalink
Fix typo causing multi-line byte span crash
Browse files Browse the repository at this point in the history
  • Loading branch information
VonTum authored and zesterer committed Mar 28, 2024
1 parent a45d833 commit 4ca1b68
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ impl<S: Span> Report<'_, S> {
// We can subtract 1 from end, because get_byte_line doesn't actually index into the text.
let end_pos = given_label_span.end - 1;
let Some((end_line_obj, end_line, end_byte_col)) = src.get_byte_line(end_pos) else {continue};
let end_line_text = src.get_line_text(start_line_obj).unwrap();
let end_line_text = src.get_line_text(end_line_obj).unwrap();
// Have to add 1 back now, so we don't cut a char in two.
let num_chars_before_end = end_line_text[..end_byte_col+1].chars().count();
let end_char_offset = end_line_obj.offset() + num_chars_before_end;
Expand Down

0 comments on commit 4ca1b68

Please sign in to comment.