new key binding macro

This commit is contained in:
🪞👃🪞 2025-01-02 21:03:20 +01:00
parent 5bc19a45d2
commit 6c266fcfca
16 changed files with 254 additions and 251 deletions

View file

@ -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)