Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-term/src/ui/document.rs')
-rw-r--r--helix-term/src/ui/document.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/helix-term/src/ui/document.rs b/helix-term/src/ui/document.rs
index d1a74e7e..8423ae8e 100644
--- a/helix-term/src/ui/document.rs
+++ b/helix-term/src/ui/document.rs
@@ -60,7 +60,9 @@ impl<H: Iterator<Item = HighlightEvent>> Iterator for StyleIter<'_, H> {
acc.patch(self.theme.highlight(span.0))
});
if self.kind == StyleIterKind::BaseHighlights {
- end = self.text.byte_to_next_char(end);
+ // Move the end byte index to the nearest character boundary (rounding up)
+ // and convert it to a character index.
+ end = self.text.byte_to_char(self.text.ceil_char_boundary(end));
}
return Some((style, end));
}