mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 20:26:42 +01:00
new key binding macro
This commit is contained in:
parent
5bc19a45d2
commit
6c266fcfca
16 changed files with 254 additions and 251 deletions
|
|
@ -114,12 +114,11 @@ command!(|self: FileBrowserCommand, state: PoolModel|{
|
|||
};
|
||||
None
|
||||
});
|
||||
input_to_command!(FileBrowserCommand:<Tui>|state: PoolModel,from|{
|
||||
|
||||
input_to_command!(FileBrowserCommand: |state: PoolModel, input: Event|{
|
||||
use FileBrowserCommand::*;
|
||||
use KeyCode::{Up, Down, Left, Right, Enter, Esc, Backspace, Char};
|
||||
if let Some(PoolMode::Import(_index, browser)) = &state.mode {
|
||||
match from.event() {
|
||||
match input {
|
||||
key_pat!(Up) => Select(browser.index.overflowing_sub(1).0
|
||||
.min(browser.len().saturating_sub(1))),
|
||||
key_pat!(Down) => Select(browser.index.saturating_add(1)
|
||||
|
|
@ -133,7 +132,7 @@ input_to_command!(FileBrowserCommand:<Tui>|state: PoolModel,from|{
|
|||
_ => return None
|
||||
}
|
||||
} else if let Some(PoolMode::Export(_index, browser)) = &state.mode {
|
||||
match from.event() {
|
||||
match input {
|
||||
key_pat!(Up) => Select(browser.index.overflowing_sub(1).0
|
||||
.min(browser.len())),
|
||||
key_pat!(Down) => Select(browser.index.saturating_add(1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue