mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 04:06:45 +01:00
focus: exit on next/prev
This commit is contained in:
parent
adb666c527
commit
ac8e8b2bf0
4 changed files with 18 additions and 16 deletions
|
|
@ -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)))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue