diff options
| author | Aram Drevekenin <aram@poor.dev> | 2026-02-24 13:10:40 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-02-24 13:10:40 +0100 |
| commit | 8cd6286c3ffc10d14fdafd5005fa89b0f7fdcd44 (patch) | |
| tree | c6341f5e3e251ae17db0c3427ddaf1e54d4fa91c /default-plugins/sequence/src/state/execution.rs | |
| parent | Allow closing replaced panes when opening panes in place (#4760) (diff) | |
| download | sl0ppij-8cd6286c3ffc10d14fdafd5005fa89b0f7fdcd44.tar.gz sl0ppij-8cd6286c3ffc10d14fdafd5005fa89b0f7fdcd44.tar.xz sl0ppij-8cd6286c3ffc10d14fdafd5005fa89b0f7fdcd44.zip | |
remove sequence plugin (#4761)
Diffstat (limited to 'default-plugins/sequence/src/state/execution.rs')
| -rw-r--r-- | default-plugins/sequence/src/state/execution.rs | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/default-plugins/sequence/src/state/execution.rs b/default-plugins/sequence/src/state/execution.rs deleted file mode 100644 index 42d4112a..00000000 --- a/default-plugins/sequence/src/state/execution.rs +++ /dev/null @@ -1,87 +0,0 @@ -use crate::path_formatting::format_cwd; -use crate::state::{CommandEntry, CommandStatus}; -use std::path::PathBuf; -use zellij_tile::prelude::*; - -pub struct Execution { - pub all_commands: Vec<CommandEntry>, - pub current_running_command_index: usize, - pub is_running: bool, - pub displayed_pane_id: Option<PaneId>, -} - -impl Execution { - pub fn new() -> Self { - Self { - all_commands: vec![CommandEntry::default()], - current_running_command_index: 0, - is_running: false, - displayed_pane_id: None, - } - } - - pub fn longest_cwd_display(&self, global_cwd: &Option<PathBuf>) -> String { - self.all_commands - .iter() - .map(|cmd| { - let cwd = cmd.get_cwd().or_else(|| global_cwd.clone()); - if let Some(cwd) = &cwd { - format_cwd(cwd) - } else { - "~".to_string() - } - }) - .max_by_key(|s| s.len()) - .unwrap_or_else(|| "~".to_string()) - } - - pub fn remove_empty_commands(&mut self) { - if self.all_commands.iter().len() > 1 { - self.all_commands.retain(|c| !c.get_text().is_empty()); - } - } - - pub fn get_first_command(&self) -> Option<CommandEntry> { - self.all_commands.iter().next().cloned() - } - - pub fn set_command_status(&mut self, command_index: usize, status: CommandStatus) { - self.all_commands - .get_mut(command_index) - .map(|c| c.set_status(status)); - } - - pub fn set_current_running_command_status(&mut self, status: CommandStatus) { - self.all_commands - .get_mut(self.current_running_command_index) - .map(|c| c.set_status(status)); - } - - pub fn get_current_running_command_status(&self) -> Option<CommandStatus> { - self.all_commands - .get(self.current_running_command_index) - .map(|c| c.get_status()) - } - - pub fn can_run_sequence(&self) -> bool { - self.all_commands.iter().any(|command| !command.is_empty()) - } - - pub fn copy_to_clipboard(&self) { - let text_to_copy = self - .all_commands - .iter() - .map(|c| format!("{}", c.get_text())) - .collect::<Vec<_>>() - .join("\n"); - if !text_to_copy.is_empty() { - copy_to_clipboard(text_to_copy); - } - } -} - -impl Default for Execution { - fn default() -> Self { - Self::new() - } -} |
