diff options
| author | Ross Delinger <rossdylan@fastmail.com> | 2025-03-31 17:32:02 -0700 |
|---|---|---|
| committer | Ross Delinger <rossdylan@fastmail.com> | 2025-03-31 17:32:02 -0700 |
| commit | f8a9c92caea03e25034a78cc3c66d866d475e4d7 (patch) | |
| tree | 8cd114e5767e6ce493e1d7453cc3cc7faf72bc6d | |
| parent | bca0d609b4e055ffa5c5b2bc973e7b6a4185cb5b (diff) | |
| download | rust-f8a9c92caea03e25034a78cc3c66d866d475e4d7.tar.gz rust-f8a9c92caea03e25034a78cc3c66d866d475e4d7.zip | |
fix: Fix panic in progress due to splitting unicode incorrectly
| -rw-r--r-- | src/tools/rust-analyzer/crates/rust-analyzer/src/cli/progress_report.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/cli/progress_report.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/cli/progress_report.rs index 8b143daf2ae..c1b1d3f348d 100644 --- a/src/tools/rust-analyzer/crates/rust-analyzer/src/cli/progress_report.rs +++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/cli/progress_report.rs @@ -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()) { |
