From b1bf0dcc648e26019188ed31be8c3249b7b5a65d Mon Sep 17 00:00:00 2001 From: Pascal Kuthe Date: Tue, 9 Apr 2024 12:32:34 +0200 Subject: [PATCH] fix char/byte index mixup in overlay rendering --- helix-term/src/ui/editor.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index dc767e22eea8..2aac3d335198 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -350,7 +350,8 @@ impl EditorView { 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) }