From ce41fe386cb1844ae88956a5400617b70a1256b2 Mon Sep 17 00:00:00 2001 From: JEEVITHA KANNAN K S Date: Thu, 19 Sep 2024 07:52:36 +0530 Subject: [PATCH] Fix cmd running when selected is directory --- tui/src/state.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tui/src/state.rs b/tui/src/state.rs index ee76122a0..19b8ae1d9 100644 --- a/tui/src/state.rs +++ b/tui/src/state.rs @@ -502,12 +502,13 @@ impl AppState { } fn handle_enter(&mut self) { - if self.selected_commands.is_empty() { - // If no commands are selected, run the currently by pushing them into vector - if let Some(cmd) = self.get_selected_command() { - self.selected_commands.push(cmd); + if self.selected_item_is_cmd() { + // If no commands are selected, run the selected by pushing them into vector + if self.selected_commands.is_empty() { + if let Some(cmd) = self.get_selected_command() { + self.selected_commands.push(cmd); + } } - let command = RunningCommand::new(self.selected_commands.clone()); self.spawn_float(command, 80, 80); self.selected_commands.clear();