mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-27 12:54:42 +00:00
Style
Co-Authored-By: Max Brunsfeld <max@zed.dev>
This commit is contained in:
parent
023ecd595b
commit
41b2fde10d
1 changed files with 7 additions and 7 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue