More selection actions: (Ctrl +) Shift + Left/Right, Shift + Home/End

This commit is contained in:
FabianLars 2020-02-25 17:03:52 +01:00
parent c47e30e960
commit 0d8d236be6
2 changed files with 45 additions and 5 deletions

View file

@ -58,7 +58,11 @@ impl Cursor {
/* expand/shrink selection */
// TODO: (whole section): Return State::Cursor if start == end after operation
pub fn select_range(&mut self, start: usize, end: usize) {
self.state = State::Selection { start, end };
if start != end {
self.state = State::Selection { start, end };
} else {
self.state = State::Index(start);
}
}
pub fn select_left(&mut self) {