Remove Input action, detect ignored input in vim via an event

This commit is contained in:
Max Brunsfeld 2022-07-21 13:40:48 -07:00
parent beeaec8647
commit 2142fca673
5 changed files with 34 additions and 27 deletions

View file

@ -22,9 +22,20 @@ fn editor_focused(EditorFocused(editor): &EditorFocused, cx: &mut MutableAppCont
vim.active_editor = Some(editor.downgrade());
vim.selection_subscription = Some(cx.subscribe(editor, |editor, event, cx| {
if editor.read(cx).leader_replica_id().is_none() {
if let editor::Event::SelectionsChanged { local: true } = event {
let newest_empty = editor.read(cx).selections.newest::<usize>(cx).is_empty();
editor_local_selections_changed(newest_empty, cx);
match event {
editor::Event::SelectionsChanged { local: true } => {
let newest_empty =
editor.read(cx).selections.newest::<usize>(cx).is_empty();
editor_local_selections_changed(newest_empty, cx);
}
editor::Event::IgnoredInput => {
Vim::update(cx, |vim, cx| {
if vim.active_operator().is_some() {
vim.clear_operator(cx);
}
});
}
_ => (),
}
}
}));