allow event bubbling

This commit is contained in:
🪞👃🪞 2024-06-20 19:32:24 +03:00
parent f77c84a99c
commit 225c686db9
10 changed files with 90 additions and 100 deletions

View file

@ -112,17 +112,17 @@ pub use crate::{key, keymap};
pub fn handle_keymap <T> (
commands: &[KeyBinding<T>], state: &mut T, event: &AppEvent
) -> Result<(), Box<dyn Error>> {
) -> Result<bool, Box<dyn Error>> {
match event {
AppEvent::Input(Event::Key(event)) => {
for (code, modifiers, _, _, command) in commands.iter() {
if *code == event.code && modifiers.bits() == event.modifiers.bits() {
command(state);
break
return Ok(true)
}
}
},
_ => {}
};
Ok(())
Ok(false)
}