mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 04:06:45 +01:00
control transport values
This commit is contained in:
parent
33e5f47526
commit
45021bc77a
10 changed files with 168 additions and 86 deletions
32
src/control/focus.rs
Normal file
32
src/control/focus.rs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
use crate::{core::*, model::{App, AppSection}};
|
||||
|
||||
pub const KEYMAP_FOCUS: &'static [KeyBinding<App>] = keymap!(App {
|
||||
[Char(';'), NONE, "command", "open command palette", |app: &mut App| {
|
||||
app.modal = Some(Box::new(crate::view::HelpModal::new()));
|
||||
Ok(true)
|
||||
}],
|
||||
[Tab, NONE, "focus_next", "focus next area", focus_next],
|
||||
[Tab, SHIFT, "focus_prev", "focus previous area", focus_prev],
|
||||
[Esc, NONE, "focus_exit", "unfocus", |app: &mut App|{
|
||||
app.entered = false;
|
||||
Ok(true)
|
||||
}],
|
||||
[Enter, NONE, "focus_enter", "activate item at cursor", |app: &mut App|{
|
||||
app.entered = true;
|
||||
Ok(true)
|
||||
}],
|
||||
});
|
||||
|
||||
pub fn focus_next (app: &mut App) -> Usually<bool> {
|
||||
app.section.next();
|
||||
app.transport.focused = app.section == AppSection::Transport;
|
||||
app.transport.entered = app.entered;
|
||||
Ok(true)
|
||||
}
|
||||
|
||||
pub fn focus_prev (app: &mut App) -> Usually<bool> {
|
||||
app.section.prev();
|
||||
app.transport.focused = app.section == AppSection::Transport;
|
||||
app.transport.entered = app.entered;
|
||||
Ok(true)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue