Merge pull request #19490 from rossdylan/fix-unicode-progress-report

fix: Fix panic in progress due to splitting unicode incorrectly
This commit is contained in:
Chayim Refael Friedman 2025-04-01 01:44:46 +00:00 committed by GitHub
commit 082ebaadae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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()) {