Initial visual mode

This commit is contained in:
Keith Simmons 2022-05-03 10:29:57 -07:00
parent 5e2e859413
commit 37c921f972
13 changed files with 621 additions and 113 deletions

View file

@ -355,13 +355,21 @@ impl DisplaySnapshot {
pub fn clip_point(&self, point: DisplayPoint, bias: Bias) -> DisplayPoint {
let mut clipped = self.blocks_snapshot.clip_point(point.0, bias);
if self.clip_at_line_ends && clipped.column == self.line_len(clipped.row) {
clipped.column = clipped.column.saturating_sub(1);
clipped = self.blocks_snapshot.clip_point(clipped, Bias::Left);
if self.clip_at_line_ends {
clipped = self.clip_at_line_end(DisplayPoint(clipped)).0
}
DisplayPoint(clipped)
}
pub fn clip_at_line_end(&self, point: DisplayPoint) -> DisplayPoint {
let mut point = point.0;
if point.column == self.line_len(point.row) {
point.column = point.column.saturating_sub(1);
point = self.blocks_snapshot.clip_point(point, Bias::Left);
}
DisplayPoint(point)
}
pub fn folds_in_range<'a, T>(
&'a self,
range: Range<T>,