fix: Fix panic in progress due to splitting unicode incorrectly

This commit is contained in:
Ross Delinger 2025-03-31 17:32:02 -07:00
parent 8a84c2bc28
commit 1b49b41248

View File

@ -79,8 +79,8 @@ impl<'a> ProgressReport<'a> {
// Backtrack to the first differing character
let mut output = String::new();
output += &'\x08'.to_string().repeat(self.text.len() - common_prefix_length);
// Output new suffix
output += &text[common_prefix_length..text.len()];
// Output new suffix, using chars() iter to ensure unicode compatibility
output.extend(text.chars().skip(common_prefix_length));
// If the new text is shorter than the old one: delete overlapping characters
if let Some(overlap_count) = self.text.len().checked_sub(text.len()) {