Always clip buffer points when clipping display points
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
parent
f898dc6dae
commit
4c22774694
2 changed files with 8 additions and 16 deletions
|
@ -598,7 +598,6 @@ impl BlockSnapshot {
|
||||||
}
|
}
|
||||||
|
|
||||||
let output_start = Point::new(output_start_row.0, 0);
|
let output_start = Point::new(output_start_row.0, 0);
|
||||||
if point.0 > output_start {
|
|
||||||
let output_overshoot = point.0 - output_start;
|
let output_overshoot = point.0 - output_start;
|
||||||
let input_start = Point::new(input_start_row.0, 0);
|
let input_start = Point::new(input_start_row.0, 0);
|
||||||
let input_point = self
|
let input_point = self
|
||||||
|
@ -606,9 +605,6 @@ impl BlockSnapshot {
|
||||||
.clip_point(WrapPoint(input_start + output_overshoot), bias);
|
.clip_point(WrapPoint(input_start + output_overshoot), bias);
|
||||||
let input_overshoot = input_point.0 - input_start;
|
let input_overshoot = input_point.0 - input_start;
|
||||||
return BlockPoint(output_start + input_overshoot);
|
return BlockPoint(output_start + input_overshoot);
|
||||||
} else {
|
|
||||||
return BlockPoint(output_start);
|
|
||||||
}
|
|
||||||
} else if search_left {
|
} else if search_left {
|
||||||
cursor.prev(&());
|
cursor.prev(&());
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -691,11 +691,7 @@ impl FoldSnapshot {
|
||||||
let buffer_position = cursor.start().1 + overshoot;
|
let buffer_position = cursor.start().1 + overshoot;
|
||||||
let clipped_buffer_position =
|
let clipped_buffer_position =
|
||||||
self.buffer_snapshot.clip_point(buffer_position, bias);
|
self.buffer_snapshot.clip_point(buffer_position, bias);
|
||||||
FoldPoint::new(
|
FoldPoint(cursor.start().0 .0 + (clipped_buffer_position - cursor.start().1))
|
||||||
point.row(),
|
|
||||||
((point.column() as i32) + clipped_buffer_position.column as i32
|
|
||||||
- buffer_position.column as i32) as u32,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
FoldPoint(self.transforms.summary().output.lines)
|
FoldPoint(self.transforms.summary().output.lines)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue