Skip to content

Commit 409e0ac

Browse files
Merge pull request rust-lang#19490 from rossdylan/fix-unicode-progress-report
fix: Fix panic in progress due to splitting unicode incorrectly
2 parents bca0d60 + f8a9c92 commit 409e0ac

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/tools/rust-analyzer/crates/rust-analyzer/src/cli/progress_report.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ impl<'a> ProgressReport<'a> {
7979
// Backtrack to the first differing character
8080
let mut output = String::new();
8181
output += &'\x08'.to_string().repeat(self.text.len() - common_prefix_length);
82-
// Output new suffix
83-
output += &text[common_prefix_length..text.len()];
82+
// Output new suffix, using chars() iter to ensure unicode compatibility
83+
output.extend(text.chars().skip(common_prefix_length));
8484

8585
// If the new text is shorter than the old one: delete overlapping characters
8686
if let Some(overlap_count) = self.text.len().checked_sub(text.len()) {

0 commit comments

Comments
 (0)