Fix panic when deleting just-generated text (#10282)
We ran into a panic when deleting text that was just generated by a code action. This fixes it by ensuring we don't run into a 0-minus-1 panic when a buffer_range is empty. Release Notes: - Fixed panic that could occur when deleting generated-by-unsaved text. Co-authored-by: Conrad <conrad@zed.dev>
This commit is contained in:
parent
87c282d8f1
commit
4d68bf2fa6
1 changed files with 4 additions and 1 deletions
|
@ -2754,10 +2754,13 @@ impl BufferSnapshot {
|
|||
range.start + self.line_len(start.row as u32) as usize - start.column;
|
||||
}
|
||||
|
||||
buffer_ranges.push((range, node_is_name));
|
||||
if !range.is_empty() {
|
||||
buffer_ranges.push((range, node_is_name));
|
||||
}
|
||||
}
|
||||
|
||||
if buffer_ranges.is_empty() {
|
||||
matches.advance();
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue