diff options
| author | Aram Drevekenin <aram@poor.dev> | 2023-11-06 08:30:17 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-06 08:30:17 +0100 |
| commit | a3d63bec55a2decf2e57d05fab8e926045662eb3 (patch) | |
| tree | 15829ce91547bd57841f26580c7b868dacc7d745 /zellij-server/src/plugins | |
| parent | docs(changelog): renaming sessions (diff) | |
| download | sl0ppij-a3d63bec55a2decf2e57d05fab8e926045662eb3.tar.gz sl0ppij-a3d63bec55a2decf2e57d05fab8e926045662eb3.tar.xz sl0ppij-a3d63bec55a2decf2e57d05fab8e926045662eb3.zip | |
fix(plugins): start plugin pane in cwd of focused pane if possible (#2905)
* fix(plugins): start plugin pane in cwd of focused pane if possible
* disable clippy - I have had enough
* fix tests
Diffstat (limited to 'zellij-server/src/plugins')
| -rw-r--r-- | zellij-server/src/plugins/mod.rs | 15 | ||||
| -rw-r--r-- | zellij-server/src/plugins/unit/plugin_tests.rs | 70 | ||||
| -rw-r--r-- | zellij-server/src/plugins/wasm_bridge.rs | 3 |
3 files changed, 83 insertions, 5 deletions
diff --git a/zellij-server/src/plugins/mod.rs b/zellij-server/src/plugins/mod.rs index d0b8383b..5285abff 100644 --- a/zellij-server/src/plugins/mod.rs +++ b/zellij-server/src/plugins/mod.rs @@ -50,6 +50,7 @@ pub enum PluginInstruction { Option<PaneId>, // pane id to replace if this is to be opened "in-place" ClientId, Size, + Option<PathBuf>, // cwd ), Update(Vec<(Option<PluginId>, Option<ClientId>, Event)>), // Focused plugin / broadcast, client_id, event data Unload(PluginId), // plugin_id @@ -182,7 +183,8 @@ pub(crate) fn plugin_thread_main( pane_id_to_replace, client_id, size, - ) => match wasm_bridge.load_plugin(&run, tab_index, size, Some(client_id)) { + cwd, + ) => match wasm_bridge.load_plugin(&run, tab_index, size, cwd, Some(client_id)) { Ok(plugin_id) => { drop(bus.senders.send_to_screen(ScreenInstruction::AddPlugin( should_float, @@ -217,7 +219,7 @@ pub(crate) fn plugin_thread_main( log::warn!("Plugin {} not found, starting it instead", run.location); // we intentionally do not provide the client_id here because it belongs to // the cli who spawned the command and is not an existing client_id - match wasm_bridge.load_plugin(&run, tab_index, size, None) { + match wasm_bridge.load_plugin(&run, tab_index, size, None, None) { Ok(plugin_id) => { let should_be_open_in_place = false; drop(bus.senders.send_to_screen(ScreenInstruction::AddPlugin( @@ -281,8 +283,13 @@ pub(crate) fn plugin_thread_main( extracted_run_instructions.append(&mut extracted_floating_plugins); for run_instruction in extracted_run_instructions { if let Some(Run::Plugin(run)) = run_instruction { - let plugin_id = - wasm_bridge.load_plugin(&run, tab_index, size, Some(client_id))?; + let plugin_id = wasm_bridge.load_plugin( + &run, + tab_index, + size, + None, + Some(client_id), + )?; plugin_ids .entry((run.location, run.configuration)) .or_default() diff --git a/zellij-server/src/plugins/unit/plugin_tests.rs b/zellij-server/src/plugins/unit/plugin_tests.rs index d9d2229c..35e613bc 100644 --- a/zellij-server/src/plugins/unit/plugin_tests.rs +++ b/zellij-server/src/plugins/unit/plugin_tests.rs @@ -616,6 +616,7 @@ pub fn load_new_plugin_from_hd() { None, client_id, size, + None, )); std::thread::sleep(std::time::Duration::from_millis(500)); let _ = plugin_thread_sender.send(PluginInstruction::Update(vec