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
+9 -2
View File
@@ -73,7 +73,11 @@ impl Selection {
}
}
pub fn buffer_rows_for_display_rows(&self, map: &DisplayMap, ctx: &AppContext) -> Range<u32> {
pub fn buffer_rows_for_display_rows(
&self,
map: &DisplayMap,
ctx: &AppContext,
) -> (Range<u32>, Range<u32>) {
let display_start = self.start.to_display_point(map, ctx).unwrap();
let buffer_start = DisplayPoint::new(display_start.row(), 0)
.to_buffer_point(map, Bias::Left, ctx)
@@ -93,6 +97,9 @@ impl Selection {
.to_buffer_point(map, Bias::Left, ctx)
.unwrap();
buffer_start.row..buffer_end.row + 1
(
buffer_start.row..buffer_end.row + 1,
display_start.row()..display_end.row() + 1,
)
}
}