From b54951089561bd0be0ab8421d9d513e074f98abb Mon Sep 17 00:00:00 2001 From: JEEVITHA KANNAN K S Date: Tue, 1 Oct 2024 01:53:16 +0530 Subject: [PATCH] Fix selected-cmd bug (#638) --- tui/src/state.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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);