Refactor editor scrolling and implement scroll commands from vim mode

This commit is contained in:
Kay Simmons 2022-12-07 16:39:32 -08:00
parent 1920de81d9
commit cffb064c16
29 changed files with 1244 additions and 683 deletions

View file

@ -81,6 +81,28 @@ pub fn init(cx: &mut MutableAppContext) {
.detach();
}
// Any keystrokes not mapped to vim should clar the active operator
pub fn observe_keypresses(window_id: usize, cx: &mut MutableAppContext) {
cx.observe_keystrokes(window_id, |_keystroke, _result, handled_by, cx| {
dbg!(_keystroke);
dbg!(_result);
if let Some(handled_by) = handled_by {
dbg!(handled_by.name());
if handled_by.namespace() == "vim" {
return true;
}
}
Vim::update(cx, |vim, cx| {
if vim.active_operator().is_some() {
vim.clear_operator(cx);
}
});
true
})
.detach()
}
#[derive(Default)]
pub struct Vim {
editors: HashMap<usize, WeakViewHandle<Editor>>,