diff --git a/tui/src/state.rs b/tui/src/state.rs index 3448a3af..0a955c79 100644 --- a/tui/src/state.rs +++ b/tui/src/state.rs @@ -615,7 +615,8 @@ impl AppState { pub fn selected_item_is_cmd(&self) -> bool { // Any item that is not a directory or up directory (..) must be a command - !(self.selected_item_is_up_dir() || self.selected_item_is_dir()) + self.selection.selected().is_some() + && !(self.selected_item_is_up_dir() || self.selected_item_is_dir()) } pub fn selected_item_is_up_dir(&self) -> bool { let selected_index = self.selection.selected().unwrap_or(0);