Clip buffer points in DisplayMap::{prev,next}_row_boundary
This commit is contained in:
parent
2930ea8fb0
commit
368b4447ff
1 changed files with 15 additions and 1 deletions
|
@ -208,11 +208,18 @@ impl DisplaySnapshot {
|
||||||
loop {
|
loop {
|
||||||
*display_point.column_mut() = 0;
|
*display_point.column_mut() = 0;
|
||||||
let mut point = display_point.to_point(self);
|
let mut point = display_point.to_point(self);
|
||||||
|
point = self.buffer_snapshot.clip_point(point, Bias::Left);
|
||||||
point.column = 0;
|
point.column = 0;
|
||||||
let next_display_point = self.point_to_display_point(point, Bias::Left);
|
let next_display_point = self.point_to_display_point(point, Bias::Left);
|
||||||
if next_display_point == display_point {
|
if next_display_point == display_point {
|
||||||
return (display_point, point);
|
return (display_point, point);
|
||||||
}
|
}
|
||||||
|
debug_assert!(
|
||||||
|
next_display_point < display_point,
|
||||||
|
"{:?} > {:?}",
|
||||||
|
next_display_point,
|
||||||
|
display_point
|
||||||
|
);
|
||||||
display_point = next_display_point;
|
display_point = next_display_point;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -220,12 +227,19 @@ impl DisplaySnapshot {
|
||||||
pub fn next_row_boundary(&self, mut display_point: DisplayPoint) -> (DisplayPoint, Point) {
|
pub fn next_row_boundary(&self, mut display_point: DisplayPoint) -> (DisplayPoint, Point) {
|
||||||
loop {
|
loop {
|
||||||
*display_point.column_mut() = self.line_len(display_point.row());
|
*display_point.column_mut() = self.line_len(display_point.row());
|
||||||
let mut point = display_point.to_point(self);
|
let mut point = self.display_point_to_point(display_point, Bias::Right);
|
||||||
|
point = self.buffer_snapshot.clip_point(point, Bias::Right);
|
||||||
point.column = self.buffer_snapshot.line_len(point.row);
|
point.column = self.buffer_snapshot.line_len(point.row);
|
||||||
let next_display_point = self.point_to_display_point(point, Bias::Right);
|
let next_display_point = self.point_to_display_point(point, Bias::Right);
|
||||||
if next_display_point == display_point {
|
if next_display_point == display_point {
|
||||||
return (display_point, point);
|
return (display_point, point);
|
||||||
}
|
}
|
||||||
|
debug_assert!(
|
||||||
|
next_display_point > display_point,
|
||||||
|
"{:?} < {:?}",
|
||||||
|
next_display_point,
|
||||||
|
display_point
|
||||||
|
);
|
||||||
display_point = next_display_point;
|
display_point = next_display_point;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue