Merge pull request #127 from SoapyDev/fix-search-commands

Fix search commands
This commit is contained in:
Chris Titus 2024-08-08 17:24:32 -05:00 committed by GitHub
commit 2a524191f1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -142,15 +142,6 @@ fn run<B: Backend>(terminal: &mut Terminal<B>, state: &AppState) -> io::Result<(
command_opt = None;
}
} else {
if key.code == KeyCode::Char('q') {
return Ok(());
}
//Activate search mode if the forward slash key gets pressed
if key.code == KeyCode::Char('/') {
// Enter search mode
in_search_mode = true;
continue;
}
//Insert user input into the search bar
if in_search_mode {
match key.code {
@ -175,6 +166,18 @@ fn run<B: Backend>(terminal: &mut Terminal<B>, state: &AppState) -> io::Result<(
}
} else if let Some(cmd) = custom_list.handle_key(key, state) {
command_opt = Some(RunningCommand::new(cmd, state));
} else {
// Handle keys while not in search mode
match key.code {
// Exit the program
KeyCode::Char('q') => return Ok(()),
//Activate search mode if the forward slash key gets pressed
KeyCode::Char('/') => {
in_search_mode = true;
continue;
}
_ => {}
}
}
}
}