🐛 fix(utils): correct string elision boundary calculation

- fix an issue where the elision range could start mid-character
- ensure the elision range always starts at a char boundary
This commit is contained in:
Jeremiah Russell
2025-10-11 23:00:01 +01:00
committed by Jeremiah Russell
parent 7ffa25295c
commit 6f2262cdb3

View File

@@ -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
}