🐛 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:
committed by
Jeremiah Russell
parent
7ffa25295c
commit
6f2262cdb3
@@ -46,7 +46,10 @@ impl Elide for String {
|
|||||||
if self.len() <= to {
|
if self.len() <= to {
|
||||||
self
|
self
|
||||||
} else {
|
} 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.replace_range(range.., " ...");
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user