add Exit trait to modals

This commit is contained in:
🪞👃🪞 2024-07-12 16:05:16 +03:00
parent 0cc8d88e5f
commit 33e5f47526
6 changed files with 67 additions and 33 deletions

View file

@ -6,7 +6,9 @@ handle!{
App |self, e| {
if let Some(ref mut modal) = self.modal {
if modal.handle(e)? {
self.modal = None;
if modal.exited() {
self.modal = None;
}
return Ok(true)
};
}
@ -145,10 +147,12 @@ pub const KEYMAP: &'static [KeyBinding<App>] = keymap!(App {
fn focus_next (app: &mut App) -> Usually<bool> {
app.section.next();
app.transport.focused = app.section == AppSection::Transport;
Ok(true)
}
fn focus_prev (app: &mut App) -> Usually<bool> {
app.section.prev();
app.transport.focused = app.section == AppSection::Transport;
Ok(true)
}