aboutsummaryrefslogtreecommitdiffstats
path: root/zellij-server
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2026-02-25 14:44:58 +0100
committerGitHub <noreply@github.com>2026-02-25 14:44:58 +0100
commit56d31239cb65a39ecd38ebe352c3288317269099 (patch)
tree7eaff8a9bf2012a6ac52f4dc31f0afc6060e174f /zellij-server
parentfix: properly offset viewport when refreshing (#4766) (diff)
downloadsl0ppij-56d31239cb65a39ecd38ebe352c3288317269099.tar.gz
sl0ppij-56d31239cb65a39ecd38ebe352c3288317269099.tar.xz
sl0ppij-56d31239cb65a39ecd38ebe352c3288317269099.zip
fix: translate plugin paths in api (add missing methods) (#4767)
* fix: translate plugin paths in api (add missing methods) * fix test
Diffstat (limited to 'zellij-server')
-rw-r--r--zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__switch_session_with_layout_and_cwd_plugin_command.snap2
-rw-r--r--zellij-server/src/plugins/zellij_exports.rs16
2 files changed, 15 insertions, 3 deletions
diff --git a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__switch_session_with_layout_and_cwd_plugin_command.snap b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__switch_session_with_layout_and_cwd_plugin_command.snap
index dd224994..c847c31b 100644
--- a/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__switch_session_with_layout_and_cwd_plugin_command.snap
+++ b/zellij-server/src/plugins/unit/snapshots/zellij_server__plugins__plugin_tests__switch_session_with_layout_and_cwd_plugin_command.snap
@@ -16,7 +16,7 @@ Some(
),
),
cwd: Some(
- "/tmp",
+ "/foo/bar",
),
},
1,
diff --git a/zellij-server/src/plugins/zellij_exports.rs b/zellij-server/src/plugins/zellij_exports.rs
index 7d49441b..2f42e91a 100644
--- a/zellij-server/src/plugins/zellij_exports.rs
+++ b/zellij-server/src/plugins/zellij_exports.rs
@@ -1101,6 +1101,16 @@ fn open_editor_pane_in_new_tab(
context: BTreeMap<String, String>,
) {
let _ = context; // context is not currently used for editor panes in new tab
+ let path = translate_plugin_path(env, file_to_open.path);
+ let cwd = file_to_open
+ .cwd
+ .map(|cwd| translate_plugin_path(env, cwd))
+ .or_else(|| Some(env.plugin_cwd.clone()));
+ let file_to_open = FileToOpen {
+ path,
+ cwd,
+ ..file_to_open
+ };
let initial_panes = Some(vec![CommandOrPlugin::File(file_to_open)]);
let action = Action::NewTab {
tiled_layout: None,
@@ -2679,7 +2689,7 @@ fn apply_layout(env: &PluginEnv, layout: Layout) {
}
fn new_tab(env: &PluginEnv, name: Option<String>, cwd: Option<String>) {
- let cwd = cwd.map(|c| PathBuf::from(c));
+ let cwd = cwd.map(|c| translate_plugin_path(env, PathBuf::from(c)));
let action = Action::NewTab {
tiled_layout: None,
floating_layouts: vec![],
@@ -2793,7 +2803,9 @@ fn switch_session(
} else {
let client_id = env.client_id;
let tab_position = tab_position.map(|p| p + 1); // ¯\_()_/¯
- let cwd = cwd.or_else(|| Some(env.plugin_cwd.clone()));
+ let cwd = cwd
+ .map(|c| translate_plugin_path(env, c))
+ .or_else(|| Some(env.plugin_cwd.clone()));
let connect_to_session = ConnectToSession {
name: session_name,
tab_position,