diff options
| author | Aram Drevekenin <aram@poor.dev> | 2022-12-24 15:48:04 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-24 15:48:04 +0100 |
| commit | 799fa5de8dfd0b826be0f903796bba48a470127e (patch) | |
| tree | 8c202e116b757162cadd0cc350da256b9741e248 /zellij-server/src/plugins | |
| parent | docs(changelog): remove nix support (diff) | |
| download | sl0ppij-799fa5de8dfd0b826be0f903796bba48a470127e.tar.gz sl0ppij-799fa5de8dfd0b826be0f903796bba48a470127e.tar.xz sl0ppij-799fa5de8dfd0b826be0f903796bba48a470127e.zip | |
Floating panes in layouts (#2047)
* work
* tests passing
* tests: floating panes in layouts
* panes(plugins): floating plugins working
* refactor(tab): layout applier
* style(comment): remove outdated
* style(fmt): rustfmt
Diffstat (limited to 'zellij-server/src/plugins')
| -rw-r--r-- | zellij-server/src/plugins/mod.rs | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/zellij-server/src/plugins/mod.rs b/zellij-server/src/plugins/mod.rs index 100833ae..ba46a545 100644 --- a/zellij-server/src/plugins/mod.rs +++ b/zellij-server/src/plugins/mod.rs @@ -12,7 +12,7 @@ use zellij_utils::{ errors::{prelude::*, ContextType, PluginContext}, input::{ command::TerminalAction, - layout::{Layout, PaneLayout, Run, RunPlugin, RunPluginLocation}, + layout::{FloatingPanesLayout, Layout, PaneLayout, Run, RunPlugin, RunPluginLocation}, plugins::PluginsConfig, }, pane_size::Size, @@ -29,6 +29,7 @@ pub enum PluginInstruction { NewTab( Option<TerminalAction>, Option<PaneLayout>, + Vec<FloatingPanesLayout>, Option<String>, // tab name usize, // tab_index ClientId, @@ -69,7 +70,6 @@ pub(crate) fn plugin_thread_main( let (event, mut err_ctx) = bus.recv().expect("failed to receive event on channel"); err_ctx.add_call(ContextType::Plugin((&event).into())); match event { - // TODO: remove pid_tx from here PluginInstruction::Load(run, tab_index, client_id, size) => { wasm_bridge.load_plugin(&run, tab_index, size, client_id)?; }, @@ -91,16 +91,22 @@ pub(crate) fn plugin_thread_main( PluginInstruction::NewTab( terminal_action, tab_layout, + floating_panes_layout, tab_name, tab_index, client_id, ) => { let mut plugin_ids: HashMap<RunPluginLocation, Vec<u32>> = HashMap::new(); - let extracted_run_instructions = tab_layout + let mut extracted_run_instructions = tab_layout .clone() - .unwrap_or_else(|| layout.new_tab()) + .unwrap_or_else(|| layout.new_tab().0) .extract_run_instructions(); - let size = Size::default(); // TODO: is this bad? + let size = Size::default(); + let mut extracted_floating_plugins: Vec<Option<Run>> = floating_panes_layout + .iter() + .map(|f| f.run.clone()) + .collect(); + 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 = @@ -111,6 +117,7 @@ pub(crate) fn plugin_thread_main( drop(bus.senders.send_to_pty(PtyInstruction::NewTab( terminal_action, tab_layout, + floating_panes_layout, tab_name, tab_index, plugin_ids, |
