You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gobang/src/handlers/database_list.rs

23 lines
786 B
Rust

use crate::app::{App, FocusBlock};
use crate::event::Key;
pub async fn handler(key: Key, app: &mut App, focused: bool) -> anyhow::Result<()> {
if focused {
match key {
Key::Char('j') => app.next_database(),
Key::Char('k') => app.previous_database(),
Key::Esc => app.focus_block = FocusBlock::DabataseList(false),
_ => (),
}
} else {
match key {
Key::Char('j') => app.focus_block = FocusBlock::TableList(false),
Key::Char('l') => app.focus_block = FocusBlock::RecordTable(false),
Key::Char('c') => app.focus_block = FocusBlock::ConnectionList,
Key::Enter => app.focus_block = FocusBlock::DabataseList(true),
_ => (),
}
}
Ok(())
}