Always clip buffer points when clipping display points

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Max Brunsfeld 2021-12-15 17:58:24 -08:00
parent f898dc6dae
commit 4c22774694
2 changed files with 8 additions and 16 deletions

View file

@ -598,7 +598,6 @@ impl BlockSnapshot {
}
let output_start = Point::new(output_start_row.0, 0);
if point.0 > output_start {
let output_overshoot = point.0 - output_start;
let input_start = Point::new(input_start_row.0, 0);
let input_point = self
@ -606,9 +605,6 @@ impl BlockSnapshot {
.clip_point(WrapPoint(input_start + output_overshoot), bias);
let input_overshoot = input_point.0 - input_start;
return BlockPoint(output_start + input_overshoot);
} else {
return BlockPoint(output_start);
}
} else if search_left {
cursor.prev(&());
} else {

View file

@ -691,11 +691,7 @@ impl FoldSnapshot {
let buffer_position = cursor.start().1 + overshoot;
let clipped_buffer_position =
self.buffer_snapshot.clip_point(buffer_position, bias);
FoldPoint::new(
point.row(),
((point.column() as i32) + clipped_buffer_position.column as i32
- buffer_position.column as i32) as u32,
)
FoldPoint(cursor.start().0 .0 + (clipped_buffer_position - cursor.start().1))
}
} else {
FoldPoint(self.transforms.summary().output.lines)