Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

text: Temporarily remove `assert_char_boundary` panics (#42919)

Lukas Wirth6bea23e99085
diff --git a/crates/multi_buffer/src/multi_buffer.rs b/crates/multi_buffer/src/multi_buffer.rs
index 5be61d1efe1..43def73ae25 100644
--- a/crates/multi_buffer/src/multi_buffer.rs
+++ b/crates/multi_buffer/src/multi_buffer.rs
@@ -3828,21 +3828,10 @@ impl MultiBufferSnapshot {
{
let main_buffer_position = cursor.main_buffer_position()?;
let buffer_snapshot = &cursor.excerpt()?.buffer;
- // remove this assert once we figure out the cause of the panics for #40453
- buffer_snapshot
- .text
- .as_rope()
- .assert_char_boundary(main_buffer_position);
return Some((buffer_snapshot, main_buffer_position));
} else if buffer_offset > region.buffer.len() {
return None;
}
- // remove this assert once we figure out the cause of the panics for #40453
- region
- .buffer
- .text
- .as_rope()
- .assert_char_boundary(buffer_offset);
Some((region.buffer, buffer_offset))
}
diff --git a/crates/text/src/text.rs b/crates/text/src/text.rs
index d9a6b2bb266..316bdb59fae 100644
--- a/crates/text/src/text.rs
+++ b/crates/text/src/text.rs
@@ -2447,7 +2447,6 @@ impl BufferSnapshot {
if offset > self.visible_text.len() {
panic!("offset {} is out of bounds", offset)
}
- self.visible_text.assert_char_boundary(offset);
let (start, _, item) = self.fragments.find::<usize, _>(&None, &offset, bias);
let fragment = item.unwrap();
let overshoot = offset - start;