aboutsummaryrefslogtreecommitdiffstats
path: root/zellij-server/src/screen.rs
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2024-08-07 19:20:41 +0200
committerGitHub <noreply@github.com>2024-08-07 19:20:41 +0200
commitd44950a5bd15eb3dae6804ea527181204946ee5b (patch)
treebfdf5e6c5bc46140e6eca533d8b48f1ae227d2a9 /zellij-server/src/screen.rs
parentdocs(changelog): floating_panes cwd fix (diff)
downloadsl0ppij-d44950a5bd15eb3dae6804ea527181204946ee5b.tar.gz
sl0ppij-d44950a5bd15eb3dae6804ea527181204946ee5b.tar.xz
sl0ppij-d44950a5bd15eb3dae6804ea527181204946ee5b.zip
feat(plugins): rerun_command_pane API (#3546)
* feat(plugins): rerun_command_pane API * fix tests
Diffstat (limited to '')
-rw-r--r--zellij-server/src/screen.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/zellij-server/src/screen.rs b/zellij-server/src/screen.rs
index 2484b3eb..b67b68e7 100644
--- a/zellij-server/src/screen.rs
+++ b/zellij-server/src/screen.rs
@@ -368,6 +368,7 @@ pub enum ScreenInstruction {
keybinds: Option<Keybinds>,
default_mode: Option<InputMode>,
},
+ RerunCommandPane(u32), // u32 - terminal pane id
}
impl From<&ScreenInstruction> for ScreenContext {
@@ -553,6 +554,7 @@ impl From<&ScreenInstruction> for ScreenContext {
ScreenInstruction::RenameSession(..) => ScreenContext::RenameSession,
ScreenInstruction::ListClientsMetadata(..) => ScreenContext::ListClientsMetadata,
ScreenInstruction::Reconfigure { .. } => ScreenContext::Reconfigure,
+ ScreenInstruction::RerunCommandPane { .. } => ScreenContext::RerunCommandPane,
}
}
}
@@ -1978,6 +1980,22 @@ impl Screen {
};
Ok(())
}
+ pub fn rerun_command_pane_with_id(&mut self, terminal_pane_id: u32) {
+ let mut found = false;
+ for tab in self.tabs.values_mut() {
+ if tab.has_pane_with_pid(&PaneId::Terminal(terminal_pane_id)) {
+ tab.rerun_terminal_pane_with_id(terminal_pane_id);
+ found = true;
+ break;
+ }
+ }
+ if !found {
+ log::error!(
+ "Failed to find terminal pane with id: {} to run",
+ terminal_pane_id
+ );
+ }
+ }
pub fn break_pane(
&mut self,
default_shell: Option<TerminalAction>,
@@ -4067,6 +4085,9 @@ pub(crate) fn screen_thread_main(
.reconfigure_mode_info(keybinds, default_mode, client_id)
.non_fatal();
},
+ ScreenInstruction::RerunCommandPane(terminal_pane_id) => {
+ screen.rerun_command_pane_with_id(terminal_pane_id)
+ },
}
}
Ok(())