🎨 point_to_display_point & display_point_to_point

This commit is contained in:
Max Brunsfeld 2021-12-15 15:45:02 -08:00
parent 368b4447ff
commit f4115ddc3c

View file

@ -245,21 +245,19 @@ impl DisplaySnapshot {
} }
fn point_to_display_point(&self, point: Point, bias: Bias) -> DisplayPoint { fn point_to_display_point(&self, point: Point, bias: Bias) -> DisplayPoint {
DisplayPoint( let fold_point = point.to_fold_point(&self.folds_snapshot, bias);
self.blocks_snapshot.to_block_point( let tab_point = self.tabs_snapshot.to_tab_point(fold_point);
self.wraps_snapshot.from_tab_point( let wrap_point = self.wraps_snapshot.from_tab_point(tab_point);
self.tabs_snapshot let block_point = self.blocks_snapshot.to_block_point(wrap_point);
.to_tab_point(point.to_fold_point(&self.folds_snapshot, bias)), DisplayPoint(block_point)
),
),
)
} }
fn display_point_to_point(&self, point: DisplayPoint, bias: Bias) -> Point { fn display_point_to_point(&self, point: DisplayPoint, bias: Bias) -> Point {
let unblocked_point = self.blocks_snapshot.to_wrap_point(point.0); let block_point = point.0;
let unwrapped_point = self.wraps_snapshot.to_tab_point(unblocked_point); let wrap_point = self.blocks_snapshot.to_wrap_point(block_point);
let unexpanded_point = self.tabs_snapshot.to_fold_point(unwrapped_point, bias).0; let tab_point = self.wraps_snapshot.to_tab_point(wrap_point);
unexpanded_point.to_buffer_point(&self.folds_snapshot) let fold_point = self.tabs_snapshot.to_fold_point(tab_point, bias).0;
fold_point.to_buffer_point(&self.folds_snapshot)
} }
pub fn max_point(&self) -> DisplayPoint { pub fn max_point(&self) -> DisplayPoint {