Fix movement across soft wrap boundaries

Co-Authored-By: Antonio Scandurra <me@as-cii.com>
This commit is contained in:
Nathan Sobo
2021-07-30 09:50:28 -07:00
committed by Max Brunsfeld
co-authored by Antonio Scandurra
parent c779633154
commit 492a09f1be
3 changed files with 19 additions and 10 deletions
+4 -7
View File
@@ -495,7 +495,7 @@ impl Snapshot {
}
pub fn max_point(&self) -> WrapPoint {
self.to_wrap_point(self.tab_snapshot.max_point(), Bias::Right)
self.to_wrap_point(self.tab_snapshot.max_point())
}
pub fn line_len(&self, row: u32) -> u32 {
@@ -548,9 +548,9 @@ impl Snapshot {
TabPoint(tab_point)
}
pub fn to_wrap_point(&self, point: TabPoint, bias: Bias) -> WrapPoint {
pub fn to_wrap_point(&self, point: TabPoint) -> WrapPoint {
let mut cursor = self.transforms.cursor::<TabPoint, WrapPoint>();
cursor.seek(&point, bias, &());
cursor.seek(&point, Bias::Right, &());
WrapPoint(cursor.sum_start().0 + (point.0 - cursor.seek_start().0))
}
@@ -564,10 +564,7 @@ impl Snapshot {
}
}
self.to_wrap_point(
self.tab_snapshot.clip_point(self.to_tab_point(point), bias),
bias,
)
self.to_wrap_point(self.tab_snapshot.clip_point(self.to_tab_point(point), bias))
}
fn check_invariants(&self) {