Skip block lines when moving up and down

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra
2021-11-18 13:45:06 +01:00
co-authored by Nathan Sobo
parent 856768a43c
commit 0f1eb3dd2e
3 changed files with 32 additions and 10 deletions
@@ -558,6 +558,12 @@ impl BlockSnapshot {
}
}
pub fn is_block_line(&self, row: u32) -> bool {
let mut cursor = self.transforms.cursor::<(BlockRow, WrapRow)>();
cursor.seek(&BlockRow(row), Bias::Right, &());
cursor.item().map_or(false, |t| t.block.is_some())
}
pub fn clip_point(&self, point: BlockPoint, bias: Bias) -> BlockPoint {
let mut cursor = self.transforms.cursor::<(BlockRow, WrapRow)>();
cursor.seek(&BlockRow(point.row), Bias::Right, &());