fix char/byte index mixup in overlay rendering (#10317)

This commit is contained in:
Pascal Kuthe 2024-04-09 18:49:30 +02:00 committed by GitHub
parent c5e257b81c
commit f601b7c278
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -350,7 +350,8 @@ pub fn overlay_syntax_highlights(
let text = doc.text().slice(..);
let row = text.char_to_line(anchor.min(text.len_chars()));
let range = Self::viewport_byte_range(text, row, height);
let mut range = Self::viewport_byte_range(text, row, height);
range = text.byte_to_char(range.start)..text.byte_to_char(range.end);
text_annotations.collect_overlay_highlights(range)
}