focus: exit on next/prev

This commit is contained in:
🪞👃🪞 2024-11-09 14:30:17 +01:00
parent adb666c527
commit ac8e8b2bf0
4 changed files with 18 additions and 16 deletions

View file

@ -5,9 +5,9 @@ pub trait Command<S>: Sized {
fn execute (self, state: &mut S) -> Perhaps<Self>;
}
pub fn delegate <B, C: Command<S>, S> (
cmd: C,
wrap: impl Fn(C)->B,
state: &mut S,
cmd: C
) -> Perhaps<B> {
Ok(cmd.execute(state)?.map(|x|wrap(x)))
}

View file

@ -64,6 +64,7 @@ pub trait FocusGrid {
if self.focused() == current { // FIXME: prevent infinite loop
self.focus_next()
}
self.focus_exit();
self.update_focus();
}
fn focus_prev (&mut self) {
@ -80,6 +81,7 @@ pub trait FocusGrid {
if self.focused() == current { // FIXME: prevent infinite loop
self.focus_prev()
}
self.focus_exit();
self.update_focus();
}
}