aboutsummaryrefslogtreecommitdiffstats
path: root/zellij-server/src/plugins
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2025-06-26 13:51:17 +0200
committerGitHub <noreply@github.com>2025-06-26 13:51:17 +0200
commit11015c8fe4db1a8ffe77e0c569f0e026c53d9776 (patch)
tree82c8513128e4be58cf6ac991b9872c9b44be5b46 /zellij-server/src/plugins
parentdocs(changelog): terminal performance (diff)
downloadsl0ppij-11015c8fe4db1a8ffe77e0c569f0e026c53d9776.tar.gz
sl0ppij-11015c8fe4db1a8ffe77e0c569f0e026c53d9776.tar.xz
sl0ppij-11015c8fe4db1a8ffe77e0c569f0e026c53d9776.zip
feat(plugin-api): allow replacing pane with existing pane (#4246)
* work * make the api work * some cleanups * close pane * style(fmt): rustfmt
Diffstat (limited to 'zellij-server/src/plugins')
-rw-r--r--zellij-server/src/plugins/zellij_exports.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/zellij-server/src/plugins/zellij_exports.rs b/zellij-server/src/plugins/zellij_exports.rs
index b928b224..7b682f6d 100644
--- a/zellij-server/src/plugins/zellij_exports.rs
+++ b/zellij-server/src/plugins/zellij_exports.rs
@@ -495,6 +495,14 @@ fn host_run_plugin_command(mut caller: Caller<'_, PluginEnv>) {
PluginCommand::ClearKeyPressesIntercepts => {
clear_key_presses_intercepts(&mut env)
},
+ PluginCommand::ReplacePaneWithExistingPane(
+ pane_id_to_replace,
+ existing_pane_id,
+ ) => replace_pane_with_existing_pane(
+ &mut env,
+ pane_id_to_replace.into(),
+ existing_pane_id.into(),
+ ),
},
(PermissionStatus::Denied, permission) => {
log::error!(
@@ -2455,6 +2463,19 @@ fn clear_key_presses_intercepts(env: &mut PluginEnv) {
.send_to_screen(ScreenInstruction::ClearKeyPressesIntercepts(env.client_id));
}
+fn replace_pane_with_existing_pane(
+ env: &mut PluginEnv,
+ pane_to_replace: PaneId,
+ existing_pane: PaneId,
+) {
+ let _ = env
+ .senders
+ .send_to_screen(ScreenInstruction::ReplacePaneWithExistingPane(
+ pane_to_replace,
+ existing_pane,
+ ));
+}
+
// Custom panic handler for plugins.
//
// This is called when a panic occurs in a plugin. Since most panics will likely originate in the
@@ -2621,6 +2642,7 @@ fn check_command_permission(
| PluginCommand::CloseMultiplePanes(..)
| PluginCommand::FloatMultiplePanes(..)
| PluginCommand::EmbedMultiplePanes(..)
+ | PluginCommand::ReplacePaneWithExistingPane(..)
| PluginCommand::KillSessions(..) => PermissionType::ChangeApplicationState,
PluginCommand::UnblockCliPipeInput(..)
| PluginCommand::BlockCliPipeInput(..)