Create a different object operator rather than pushing two operators on one input
This commit is contained in:
parent
11cfb88b36
commit
ec621c60e0
4 changed files with 24 additions and 20 deletions
|
@ -498,14 +498,16 @@ impl Vim {
|
|||
Some(Operator::HelixMatch) => {
|
||||
self.select_current_object(object, around, window, cx)
|
||||
}
|
||||
Some(Operator::SelectNext) => self.select_next_object(object, around, window, cx),
|
||||
Some(Operator::SelectPrevious) => {
|
||||
self.select_previous_object(object, around, window, cx)
|
||||
}
|
||||
_ => {
|
||||
// Can't do anything for namespace operators. Ignoring
|
||||
}
|
||||
},
|
||||
Some(Operator::HelixNext { around }) => {
|
||||
self.select_next_object(object, around, window, cx);
|
||||
}
|
||||
Some(Operator::HelixPrevious { around }) => {
|
||||
self.select_previous_object(object, around, window, cx);
|
||||
}
|
||||
Some(Operator::DeleteSurrounds) => {
|
||||
waiting_operator = Some(Operator::DeleteSurrounds);
|
||||
}
|
||||
|
|
|
@ -133,8 +133,12 @@ pub enum Operator {
|
|||
ReplaceWithRegister,
|
||||
Exchange,
|
||||
HelixMatch,
|
||||
SelectNext,
|
||||
SelectPrevious,
|
||||
HelixNext {
|
||||
around: bool,
|
||||
},
|
||||
HelixPrevious {
|
||||
around: bool,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Default, Clone, Debug)]
|
||||
|
@ -1028,8 +1032,8 @@ impl Operator {
|
|||
Operator::ReplayRegister => "@",
|
||||
Operator::ToggleComments => "gc",
|
||||
Operator::HelixMatch => "helix_m",
|
||||
Operator::SelectNext { .. } => "helix_]",
|
||||
Operator::SelectPrevious { .. } => "helix_[",
|
||||
Operator::HelixNext { .. } => "helix_next",
|
||||
Operator::HelixPrevious { .. } => "helix_previous",
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1044,8 +1048,8 @@ impl Operator {
|
|||
Operator::AutoIndent => "=".to_string(),
|
||||
Operator::ShellCommand => "=".to_string(),
|
||||
Operator::HelixMatch => "m".to_string(),
|
||||
Operator::SelectNext => "]".to_string(),
|
||||
Operator::SelectPrevious => "[".to_string(),
|
||||
Operator::HelixNext { .. } => "]".to_string(),
|
||||
Operator::HelixPrevious { .. } => "[".to_string(),
|
||||
_ => self.id().to_string(),
|
||||
}
|
||||
}
|
||||
|
@ -1086,8 +1090,8 @@ impl Operator {
|
|||
| Operator::OppositeCase
|
||||
| Operator::ToggleComments
|
||||
| Operator::HelixMatch
|
||||
| Operator::SelectNext { .. }
|
||||
| Operator::SelectPrevious { .. } => false,
|
||||
| Operator::HelixNext { .. }
|
||||
| Operator::HelixPrevious { .. } => false,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1112,8 +1116,8 @@ impl Operator {
|
|||
| Operator::ChangeSurrounds { target: None }
|
||||
| Operator::DeleteSurrounds
|
||||
| Operator::Exchange
|
||||
| Operator::SelectNext { .. }
|
||||
| Operator::SelectPrevious { .. } => true,
|
||||
| Operator::HelixNext { .. }
|
||||
| Operator::HelixPrevious { .. } => true,
|
||||
Operator::Yank
|
||||
| Operator::Object { .. }
|
||||
| Operator::FindForward { .. }
|
||||
|
|
|
@ -785,19 +785,17 @@ impl Vim {
|
|||
vim.push_operator(Operator::HelixMatch, window, cx)
|
||||
});
|
||||
Vim::action(editor, cx, |vim, action: &PushHelixNext, window, cx| {
|
||||
vim.push_operator(Operator::SelectNext, window, cx);
|
||||
vim.push_operator(
|
||||
Operator::Object {
|
||||
Operator::HelixNext {
|
||||
around: action.around,
|
||||
},
|
||||
window,
|
||||
cx,
|
||||
)
|
||||
);
|
||||
});
|
||||
Vim::action(editor, cx, |vim, action: &PushHelixPrevious, window, cx| {
|
||||
vim.push_operator(Operator::SelectPrevious, window, cx);
|
||||
vim.push_operator(
|
||||
Operator::Object {
|
||||
Operator::HelixPrevious {
|
||||
around: action.around,
|
||||
},
|
||||
window,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue