mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 11:20:54 +00:00
fix: Fix panic in progress due to splitting unicode incorrectly
This commit is contained in:
parent
8a84c2bc28
commit
1b49b41248
@ -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…
x
Reference in New Issue
Block a user