Implement Helix Support (WIP) (#19175)
Closes #4642 - Added the ability to switch to helix normal mode, with an additional helix visual mode. - <kbd>ctrl</kbd><kbd>h</kbd> from Insert mode goes to Helix Normal mode. <kbd> i </kbd> and <kbd> a </kbd> to go back. - Need to find a way to perform the helix normal mode selection with <kbd> w </kbd>, <kbd>e </kbd>, <kbd> b </kbd> as a first step. Need to figure out how the mode will interoperate with the VIM mode as the new additions are in the same crate.
This commit is contained in:
parent
c5d15fd065
commit
8f08787cf0
11 changed files with 444 additions and 12 deletions
|
@ -84,6 +84,31 @@ impl<T: Copy + Ord> Selection<T> {
|
|||
}
|
||||
self.goal = new_goal;
|
||||
}
|
||||
|
||||
pub fn set_tail(&mut self, tail: T, new_goal: SelectionGoal) {
|
||||
if tail.cmp(&self.head()) <= Ordering::Equal {
|
||||
if self.reversed {
|
||||
self.end = self.start;
|
||||
self.reversed = false;
|
||||
}
|
||||
self.start = tail;
|
||||
} else {
|
||||
if !self.reversed {
|
||||
self.start = self.end;
|
||||
self.reversed = true;
|
||||
}
|
||||
self.end = tail;
|
||||
}
|
||||
self.goal = new_goal;
|
||||
}
|
||||
|
||||
pub fn swap_head_tail(&mut self) {
|
||||
if self.reversed {
|
||||
self.reversed = false;
|
||||
} else {
|
||||
std::mem::swap(&mut self.start, &mut self.end);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Copy> Selection<T> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue