Fix WrapMap::clip_point at the end of a soft-wrapped line
If that's the case and `Bias` is `Left` we clip to the last character of the soft-wrapped line. Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
co-authored by
Nathan Sobo
parent
915c710f94
commit
ef42d14b8c
@@ -208,7 +208,16 @@ impl Snapshot {
|
||||
OutputPoint(cursor.sum_start().0 + (point.0 - cursor.seek_start().0))
|
||||
}
|
||||
|
||||
pub fn clip_point(&self, point: OutputPoint, bias: Bias) -> OutputPoint {
|
||||
pub fn clip_point(&self, mut point: OutputPoint, bias: Bias) -> OutputPoint {
|
||||
if bias == Bias::Left {
|
||||
let mut cursor = self.transforms.cursor::<OutputPoint, ()>();
|
||||
cursor.seek(&point, Bias::Right, &());
|
||||
let transform = cursor.item().expect("invalid point");
|
||||
if !transform.is_isomorphic() {
|
||||
*point.column_mut() -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
self.to_output_point(self.input.clip_point(self.to_input_point(point), bias))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user