mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-12 13:24:19 +00:00
🎨 point_to_display_point & display_point_to_point
This commit is contained in:
parent
368b4447ff
commit
f4115ddc3c
1 changed files with 10 additions and 12 deletions
|
@ -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 {
|
||||||
|
|
Loading…
Reference in a new issue