mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-28 10:39:45 +00:00
fix: Fix panic in progress due to splitting unicode incorrectly
This commit is contained in:
parent
8a84c2bc28
commit
1b49b41248
1 changed files with 2 additions and 2 deletions
|
|
@ -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()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue