diff options
| author | krolxon <krolyxon@tutanota.com> | 2024-04-29 23:20:02 +0530 |
|---|---|---|
| committer | krolxon <krolyxon@tutanota.com> | 2024-04-29 23:20:02 +0530 |
| commit | 87bb8e9473194b47c9f52e49c7fe2b632bd36aef (patch) | |
| tree | 93c29be7780a6f3677409ad4b1f349ae591dc8d0 /src/handler.rs | |
| parent | c047f63cd1c727c36c61acacba073eb03b7f8617 (diff) | |
remove redundant functions and add comments
Diffstat (limited to 'src/handler.rs')
| -rwxr-xr-x | src/handler.rs | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/handler.rs b/src/handler.rs index 8a7e7ca..a5c4edb 100755 --- a/src/handler.rs +++ b/src/handler.rs @@ -1,12 +1,11 @@ use crate::browser::FileExtension; -use std::{path::Path, time::Duration}; - use crate::{ app::{App, AppResult, SelectedTab}, ui::InputMode, }; use crossterm::event::{KeyCode, KeyEvent, KeyModifiers}; use rust_fuzzy_search::{self, fuzzy_search_sorted}; +use std::{path::Path, time::Duration}; pub fn handle_key_events(key_event: KeyEvent, app: &mut App) -> AppResult<()> { if app.inputmode == InputMode::Editing { @@ -65,6 +64,9 @@ pub fn handle_key_events(key_event: KeyEvent, app: &mut App) -> AppResult<()> { } } + // Keybind for searching + // + // Keybinds for when the search prompt is visible match key_event.code { KeyCode::Esc => { app.inputmode = InputMode::Normal; @@ -108,6 +110,10 @@ pub fn handle_key_events(key_event: KeyEvent, app: &mut App) -> AppResult<()> { _ => {} } + + // Playlist popup keybinds + // + // Keybind for when the "append to playlist" popup is visible } else if app.playlist_popup { match key_event.code { KeyCode::Char('q') | KeyCode::Esc => { @@ -183,6 +189,9 @@ pub fn handle_key_events(key_event: KeyEvent, app: &mut App) -> AppResult<()> { _ => {} } } else { + // Global keymaps + // + // Keymaps related to all the tabs match key_event.code { // Quit KeyCode::Char('q') => app.quit(), @@ -343,7 +352,8 @@ pub fn handle_key_events(key_event: KeyEvent, app: &mut App) -> AppResult<()> { // Update MPD database KeyCode::Char('U') => { - app.conn.conn.update()?; + app.conn.conn.rescan()?; + app.browser.update_directory(&mut app.conn)?; } // Search for songs |
