Account for trailing below blocks in BlockSnapshot::max_point

This commit is contained in:
Nathan Sobo 2021-11-13 19:50:42 -07:00
parent d6bc05cad0
commit b6e6dafca7
2 changed files with 8 additions and 6 deletions

View file

@ -351,7 +351,14 @@ impl BlockSnapshot {
}
pub fn max_point(&self) -> BlockPoint {
self.to_block_point(self.wrap_snapshot.max_point())
let last_transform = self.transforms.last().unwrap();
if let Some(block) = &last_transform.block {
let row = self.transforms.summary().output_rows - 1;
let column = block.text.summary().lines.column;
BlockPoint::new(row, column)
} else {
self.to_block_point(self.wrap_snapshot.max_point())
}
}
pub fn clip_point(&self, point: BlockPoint, bias: Bias) -> BlockPoint {

View file

@ -944,11 +944,6 @@ impl WrapPoint {
Self(super::Point::new(row, column))
}
#[cfg(test)]
pub fn is_zero(&self) -> bool {
self.0.is_zero()
}
pub fn row(self) -> u32 {
self.0.row
}