From f601b7c27872c1de7b3f86908337642bc122a234 Mon Sep 17 00:00:00 2001 From: Pascal Kuthe Date: Tue, 9 Apr 2024 18:49:30 +0200 Subject: [PATCH] fix char/byte index mixup in overlay rendering (#10317) --- 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 dc767e22e..2aac3d335 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) }