Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Fix inverted char boundary check causing invalid offsets (#47112)
Jordi Villar376e9585696b
diff --git a/crates/text/src/text.rs b/crates/text/src/text.rsindex 87ce4d49c14..5c78f9aea60 100644--- a/crates/text/src/text.rs+++ b/crates/text/src/text.rs@@ -2417,7 +2417,7 @@ impl BufferSnapshot {{Anchor::max_for_buffer(self.remote_id)} else {- if self+ if !self.visible_text.assert_char_boundary::<{ cfg!(debug_assertions) }>(offset){@@ -3125,7 +3125,7 @@ impl ToOffset for Point {impl ToOffset for usize {#[track_caller]fn to_offset(&self, snapshot: &BufferSnapshot) -> usize {- if snapshot+ if !snapshot.as_rope().assert_char_boundary::<{ cfg!(debug_assertions) }>(*self){