Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Style
Julia41b2fde10d82
diff --git a/crates/rope/src/rope.rs b/crates/rope/src/rope.rsindex e4f2bf50116..53713e3f7a3 100644--- a/crates/rope/src/rope.rs+++ b/crates/rope/src/rope.rs@@ -680,13 +680,12 @@ impl Chunk {fn point_to_offset(&self, target: Point) -> usize {let mut offset = 0;let mut point = Point::new(0, 0);- for ch in self.0.chars() {- if point > target {- debug_panic!("point {target:?} is inside of character {ch:?}");- return offset;- }- if point == target {+ for ch in self.0.chars() {+ if point >= target {+ if point > target {+ debug_panic!("point {target:?} is inside of character {ch:?}");+ }break;}@@ -699,7 +698,7 @@ impl Chunk {"point {target:?} is beyond the end of a line with length {}",point.column);- return offset;+ break;}} else {point.column += ch.len_utf8() as u32;@@ -707,6 +706,7 @@ impl Chunk {offset += ch.len_utf8();}+offset}