Implement add_cursor_above and add_cursor_below for buffer

This commit is contained in:
Antonio Scandurra
2021-05-11 12:35:27 +02:00
parent af6ab2762f
commit 0baff0c61d
4 changed files with 188 additions and 56 deletions
+2 -2
View File
@@ -3285,14 +3285,14 @@ mod tests {
start: self.anchor_before(range.end)?,
end: self.anchor_before(range.start)?,
reversed: true,
goal_column: None,
goal: SelectionGoal::None,
});
} else {
selections.push(Selection {
start: self.anchor_after(range.start)?,
end: self.anchor_before(range.end)?,
reversed: false,
goal_column: None,
goal: SelectionGoal::None,
});
}
}
+8 -1
View File
@@ -12,12 +12,19 @@ use std::{cmp::Ordering, mem, ops::Range};
pub type SelectionSetId = time::Lamport;
pub type SelectionsVersion = usize;
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub enum SelectionGoal {
None,
Column(u32),
ColumnRange { start: u32, end: u32 },
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct Selection {
pub start: Anchor,
pub end: Anchor,
pub reversed: bool,
pub goal_column: Option<u32>,
pub goal: SelectionGoal,
}
impl Selection {