Fix innermost brackets panic (#32120)
Release Notes: - Fixed a few rare panics that could happen when a multibuffer excerpt started with expanded deleted content.
This commit is contained in:
parent
7aa70a4858
commit
4b297a9967
2 changed files with 17 additions and 1 deletions
|
@ -6227,7 +6227,7 @@ impl MultiBufferSnapshot {
|
|||
cursor.seek_to_start_of_current_excerpt();
|
||||
let region = cursor.region()?;
|
||||
let offset = region.range.start;
|
||||
let buffer_offset = region.buffer_range.start;
|
||||
let buffer_offset = start_excerpt.buffer_start_offset();
|
||||
let excerpt_offset = cursor.excerpts.start().clone();
|
||||
Some(MultiBufferExcerpt {
|
||||
diff_transforms: cursor.diff_transforms,
|
||||
|
|
|
@ -2842,6 +2842,22 @@ async fn test_random_multibuffer(cx: &mut TestAppContext, mut rng: StdRng) {
|
|||
.unwrap()
|
||||
+ 1
|
||||
);
|
||||
let reference_ranges = cx.update(|cx| {
|
||||
reference
|
||||
.excerpts
|
||||
.iter()
|
||||
.map(|excerpt| {
|
||||
(
|
||||
excerpt.id,
|
||||
excerpt.range.to_offset(&excerpt.buffer.read(cx).snapshot()),
|
||||
)
|
||||
})
|
||||
.collect::<HashMap<_, _>>()
|
||||
});
|
||||
for i in 0..snapshot.len() {
|
||||
let excerpt = snapshot.excerpt_containing(i..i).unwrap();
|
||||
assert_eq!(excerpt.buffer_range(), reference_ranges[&excerpt.id()]);
|
||||
}
|
||||
|
||||
assert_consistent_line_numbers(&snapshot);
|
||||
assert_position_translation(&snapshot);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue