mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
allow event bubbling
This commit is contained in:
parent
f77c84a99c
commit
225c686db9
10 changed files with 90 additions and 100 deletions
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue