aboutsummaryrefslogtreecommitdiffstats
path: root/zellij-server/src/plugins
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2024-11-08 16:27:15 +0100
committerGitHub <noreply@github.com>2024-11-08 16:27:15 +0100
commit452effab8fdc86486e110ea158d7287d13d0f6ea (patch)
treedc488a0f8e48edf0b20537d8cec6af9f38c14afc /zellij-server/src/plugins
parentdocs(changelog): refix ctrl-j (diff)
downloadsl0ppij-452effab8fdc86486e110ea158d7287d13d0f6ea.tar.gz
sl0ppij-452effab8fdc86486e110ea158d7287d13d0f6ea.tar.xz
sl0ppij-452effab8fdc86486e110ea158d7287d13d0f6ea.zip
fix(plugins): cwd and usability fixes (#3749)
* fix(plugins): maintain cwd between plugin reloads * fix(plugin-manager): default to loading plugins in the foreground and allow sending space in configuration
Diffstat (limited to 'zellij-server/src/plugins')
-rw-r--r--zellij-server/src/plugins/plugin_loader.rs11
-rw-r--r--zellij-server/src/plugins/wasm_bridge.rs3
2 files changed, 7 insertions, 7 deletions
diff --git a/zellij-server/src/plugins/plugin_loader.rs b/zellij-server/src/plugins/plugin_loader.rs
index 654cc55b..32d26dd3 100644
--- a/zellij-server/src/plugins/plugin_loader.rs
+++ b/zellij-server/src/plugins/plugin_loader.rs
@@ -109,7 +109,7 @@ impl<'a> PluginLoader<'a> {
engine,
&plugin_dir,
path_to_default_shell,
- zellij_cwd,
+ Some(zellij_cwd),
capabilities,
client_attributes,
default_shell,
@@ -275,7 +275,6 @@ impl<'a> PluginLoader<'a> {
connected_clients: Arc<Mutex<Vec<ClientId>>>,
loading_indication: &mut LoadingIndication,
path_to_default_shell: PathBuf,
- zellij_cwd: PathBuf,
capabilities: PluginCapabilities,
client_attributes: ClientAttributes,
default_shell: Option<TerminalAction>,
@@ -301,7 +300,7 @@ impl<'a> PluginLoader<'a> {
engine,
&plugin_dir,
path_to_default_shell,
- zellij_cwd,
+ None,
capabilities,
client_attributes,
default_shell,
@@ -382,7 +381,7 @@ impl<'a> PluginLoader<'a> {
engine: Engine,
plugin_dir: &'a PathBuf,
path_to_default_shell: PathBuf,
- zellij_cwd: PathBuf,
+ cwd: Option<PathBuf>,
capabilities: PluginCapabilities,
client_attributes: ClientAttributes,
default_shell: Option<TerminalAction>,
@@ -405,6 +404,10 @@ impl<'a> PluginLoader<'a> {
let keybinds = running_plugin.store.data().keybinds.clone();
let default_mode = running_plugin.store.data().default_mode;
let plugin_config = running_plugin.store.data().plugin.clone();
+ // prefer the explicitly given cwd, otherwise copy it from the running plugin
+ // (when reloading a plugin, we want to copy it, when starting a new plugin instance from
+ // meomory, we want to reset it)
+ let zellij_cwd = cwd.unwrap_or_else(|| running_plugin.store.data().plugin_cwd.clone());
loading_indication.set_name(running_plugin.store.data().name());
PluginLoader::new(
plugin_cache,
diff --git a/zellij-server/src/plugins/wasm_bridge.rs b/zellij-server/src/plugins/wasm_bridge.rs
index 85479c37..eceed202 100644
--- a/zellij-server/src/plugins/wasm_bridge.rs
+++ b/zellij-server/src/plugins/wasm_bridge.rs
@@ -363,7 +363,6 @@ impl WasmBridge {
let plugin_map = self.plugin_map.clone();
let connected_clients = self.connected_clients.clone();
let path_to_default_shell = self.path_to_default_shell.clone();
- let zellij_cwd = self.zellij_cwd.clone();
let capabilities = self.capabilities.clone();
let client_attributes = self.client_attributes.clone();
let default_shell = self.default_shell.clone();
@@ -380,7 +379,6 @@ impl WasmBridge {
connected_clients.clone(),
&mut loading_indication,
path_to_default_shell.clone(),
- zellij_cwd.clone(),
capabilities.clone(),
client_attributes.clone(),
default_shell.clone(),
@@ -456,7 +454,6 @@ impl WasmBridge {
connected_clients.clone(),
&mut loading_indication,
path_to_default_shell.clone(),
- zellij_cwd.clone(),
capabilities.clone(),
client_attributes.clone(),
default_shell.clone(),