Skip to content

Commit

Permalink
Implemented Execute
Browse files Browse the repository at this point in the history
  • Loading branch information
fri committed Aug 27, 2024
1 parent 7c9fcad commit c30795b
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/fm/file_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,29 @@ impl Component for FilePanel {
}
}
}
Key::Char('x') => {
if !self.shown_file_list.is_empty() {
let entry = &self.shown_file_list[self.cursor_position];

self.stop_inputs_tx.send(Inputs::Stop).unwrap();
raw_output_suspend(&self.raw_output);

let status = Command::new(&entry.file).current_dir(&self.cwd).status();

self.stop_inputs_tx.send(Inputs::Start).unwrap();
start_inputs(self.events_tx.clone(), self.stop_inputs_rx.clone());
raw_output_activate(&self.raw_output);

self.pubsub_tx.send(PubSub::Redraw).unwrap();
self.pubsub_tx.send(PubSub::Reload).unwrap();

if let Err(e) = status {
self.pubsub_tx
.send(PubSub::Error(e.to_string(), None))
.unwrap();
}
}
}
Key::Up | Key::Char('k') => {
self.handle_up();
}
Expand Down

0 comments on commit c30795b

Please sign in to comment.