From 6f2262cdb30a5390f57bc853c99dea937cd4f79a Mon Sep 17 00:00:00 2001 From: Jeremiah Russell Date: Sat, 11 Oct 2025 23:00:01 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(utils):=20correct=20string?= =?UTF-8?q?=20elision=20boundary=20calculation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - fix an issue where the elision range could start mid-character - ensure the elision range always starts at a char boundary --- src/utils.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/utils.rs b/src/utils.rs index 41ef991..166e289 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -46,7 +46,10 @@ impl Elide for String { if self.len() <= to { self } else { - let range = get_start_boundary(self.clone(), to - 4); + let mut range = to - 4; + while !self.is_char_boundary(range) { + range -= 1; + } self.replace_range(range.., " ..."); self }