Implement move_line_up and move_line_down

This does not restore folds yet.
This commit is contained in:
Antonio Scandurra
2021-05-03 11:37:36 +02:00
parent d499fb0d44
commit 8cd451f3ca
4 changed files with 188 additions and 11 deletions
+7
View File
@@ -169,6 +169,13 @@ impl FoldMap {
false
}
pub fn to_buffer_offset(&self, point: DisplayPoint, app: &AppContext) -> Result<usize> {
let mut cursor = self.transforms.cursor::<DisplayPoint, TransformSummary>();
cursor.seek(&point, SeekBias::Right);
let overshoot = point.0 - cursor.start().display.lines;
(cursor.start().buffer.lines + overshoot).to_offset(self.buffer.read(app))
}
pub fn to_display_offset(
&self,
point: DisplayPoint,