Fix always selecting the first item to run

This commit is contained in:
afonsofrancof 2024-07-30 23:20:56 +01:00
parent c399722959
commit 5d68f49e59
No known key found for this signature in database

View File

@ -414,11 +414,6 @@ impl CustomList {
/// ///
/// Returns `Some(command)` when command is selected, othervise we returns `None` /// Returns `Some(command)` when command is selected, othervise we returns `None`
fn handle_enter(&mut self) -> Option<Command> { fn handle_enter(&mut self) -> Option<Command> {
// Ensure an item is selected if none is selected
if self.list_state.selected().is_none() {
self.list_state.select(Some(0));
}
// Get the selected index // Get the selected index
let selected = self.list_state.selected().unwrap(); let selected = self.list_state.selected().unwrap();