cargo: fmt

This commit is contained in:
Muhammad Nauman Raza 2024-05-28 20:58:22 +01:00
parent 1882a1a69e
commit 2c19b5cdee
Signed by: devraza
GPG key ID: 91EAD6081011574B
2 changed files with 15 additions and 10 deletions

View file

@ -1,7 +1,7 @@
use std::error; use std::error;
use tui_input::Input;
use ratatui::widgets::ListState; use ratatui::widgets::ListState;
use tui_input::Input;
use crate::api::SearchResult; use crate::api::SearchResult;
@ -73,7 +73,7 @@ impl Default for App {
list: ResultList { list: ResultList {
state: ListState::default(), state: ListState::default(),
items: Vec::new(), items: Vec::new(),
last_selected: None last_selected: None,
}, },
} }
} }

View file

@ -15,10 +15,15 @@ pub async fn handle_key_events(key_event: KeyEvent, app: &mut App) -> AppResult<
} => { } => {
app.quit(); app.quit();
} }
KeyEvent { code: KeyCode::Esc, .. } => { KeyEvent {
code: KeyCode::Esc, ..
} => {
app.quit(); app.quit();
} }
KeyEvent { code: KeyCode::Enter, .. } => { KeyEvent {
code: KeyCode::Enter,
..
} => {
app.list = ResultList { app.list = ResultList {
state: app.list.state.clone(), state: app.list.state.clone(),
items: query_anime(app.input.to_string()).await.unwrap().results, items: query_anime(app.input.to_string()).await.unwrap().results,
@ -32,11 +37,11 @@ pub async fn handle_key_events(key_event: KeyEvent, app: &mut App) -> AppResult<
} }
} }
match key_event.code { match key_event.code {
Char('j') | Down => app.list.next(), Char('j') | Down => app.list.next(),
Char('k') | Up => app.list.previous(), Char('k') | Up => app.list.previous(),
Char('g') => app.go_top(), Char('g') => app.go_top(),
Char('G') => app.go_bottom(), Char('G') => app.go_bottom(),
_ => {} _ => {}
} }
Ok(()) Ok(())
} }