diff options
Diffstat (limited to 'zellij-server/src/tab')
-rw-r--r-- | zellij-server/src/tab/layout_applier.rs | 15 | ||||
-rw-r--r-- | zellij-server/src/tab/mod.rs | 43 |
2 files changed, 4 insertions, 54 deletions
diff --git a/zellij-server/src/tab/layout_applier.rs b/zellij-server/src/tab/layout_applier.rs index 4f5246d33..bd0468a60 100644 --- a/zellij-server/src/tab/layout_applier.rs +++ b/zellij-server/src/tab/layout_applier.rs @@ -19,7 +19,7 @@ use std::rc::Rc; use zellij_utils::{ data::{Palette, Style}, input::layout::{ - FloatingPaneLayout, PluginUserConfiguration, Run, RunPluginOrAlias, RunPluginLocation, TiledPaneLayout, + FloatingPaneLayout, Run, RunPluginOrAlias, TiledPaneLayout, }, pane_size::{Offset, PaneGeom, Size, SizeInPixels, Viewport}, }; @@ -107,19 +107,16 @@ impl<'a> LayoutApplier<'a> { mut new_plugin_ids: HashMap<RunPluginOrAlias, Vec<u32>>, client_id: ClientId, ) -> Result<bool> { - eprintln!("apply_layout 1: {:?}", new_plugin_ids); // true => should_show_floating_panes let layout_name = layout.name.clone(); let hide_floating_panes = layout.hide_floating_panes; self.apply_tiled_panes_layout(layout, new_terminal_ids, &mut new_plugin_ids, client_id)?; - eprintln!("apply_layout 2"); let layout_has_floating_panes = self.apply_floating_panes_layout( floating_panes_layout, new_floating_terminal_ids, &mut new_plugin_ids, layout_name, )?; - eprintln!("apply_layout 3"); let should_show_floating_panes = layout_has_floating_panes && !hide_floating_panes; return Ok(should_show_floating_panes); } @@ -265,17 +262,12 @@ impl<'a> LayoutApplier<'a> { // we got from the plugin thread and pty thread let positions_and_size = positions_in_layout.iter(); for (layout, position_and_size) in positions_and_size { - // if let Some(Run::Plugin(run)) = layout.run.clone() { - // if let Some(run_plugin) = layout.run.as_ref().and_then(|r| r.get_run_plugin()) { if let Some(Run::Plugin(run)) = layout.run.clone() { let pane_title = run.location_string(); - eprintln!("new_plugin_ids: {:#?}, \nrun: {:#?}", new_plugin_ids, run); let pid = new_plugin_ids - // .get_mut(&(run_plugin.location, run_plugin.configuration)) .get_mut(&run) .and_then(|ids| ids.pop()) .with_context(err_context)?; - eprintln!("not here!"); let mut new_plugin = PluginPane::new( pid, *position_and_size, @@ -384,7 +376,6 @@ impl<'a> LayoutApplier<'a> { layout_name: Option<String>, ) -> Result<bool> { // true => has floating panes - eprintln!("apply_floating_panes_layout 1"); let err_context = || format!("Failed to apply_floating_panes_layout"); let mut layout_has_floating_panes = false; let floating_panes_layout = floating_panes_layout.iter(); @@ -401,14 +392,11 @@ impl<'a> LayoutApplier<'a> { position_and_size, ); } else if let Some(Run::Plugin(run)) = floating_pane_layout.run.clone() { - // } else if let Some(run_plugin) = floating_pane_layout.run.as_ref().and_then(|r| r.get_run_plugin()) { - eprintln!("apply_floating_panes_layout 2: {:?}", new_plugin_ids); let pane_title = run.location_string(); let pid = new_plugin_ids .get_mut(&run) .and_then(|ids| ids.pop()) .with_context(err_context)?; - eprintln!("apply_floating_panes_layout 3"); let mut new_pane = PluginPane::new( pid, position_and_size, @@ -443,7 +431,6 @@ impl<'a> LayoutApplier<'a> { self.senders, self.character_cell_size )?; - eprintln!("apply_floating_panes_layout 4"); self.floating_panes .add_pane(PaneId::Plugin(pid), Box::new(new_pane)); if floating_pane_layout.focus.unwrap_or(false) { diff --git a/zellij-server/src/tab/mod.rs b/zellij-server/src/tab/mod.rs index 585726081..de0ee7240 100644 --- a/zellij-server/src/tab/mod.rs +++ b/zellij-server/src/tab/mod.rs @@ -3588,41 +3588,13 @@ impl Tab { } pub fn find_plugin(&self, run_plugin_or_alias: &RunPluginOrAlias) -> Option<PaneId> { - // let run = Some(Run::Plugin(run_plugin_or_alias.clone())); self.tiled_panes .get_plugin_pane_id(run_plugin_or_alias) .or_else(|| self.floating_panes.get_plugin_pane_id(run_plugin_or_alias)) .or_else(|| { - - // TODO: can we somehow outsource this piece of code? - match run_plugin_or_alias { - RunPluginOrAlias::RunPlugin(..) => { - let run = Some(Run::Plugin(run_plugin_or_alias.clone())); - self.suppressed_panes - .iter() - .find(|(_id, (_, s_p))| s_p.invoked_with() == &run) - .map(|(id, _)| *id) - } - RunPluginOrAlias::Alias(plugin_alias) => { - self.suppressed_panes - .iter() - .find(|(_id, (_, s_p))| { - match s_p.invoked_with() { - Some(Run::Plugin(RunPluginOrAlias::Alias(pane_alias))) => pane_alias.name == plugin_alias.name && pane_alias.configuration == plugin_alias.configuration, - _ => false - } - }) - .map(|(id, _)| *id) - } - } - - - -// self.suppressed_panes -// .iter() -// // TODO: compare properly like in tiled_panes/floating_panes -// .find(|(_id, s_p)| s_p.1.invoked_with() == &run) -// .map(|(id, _)| *id) + self.suppressed_panes.iter() + .find(|(_id, (_, pane))| run_plugin_or_alias.is_equivalent_to_run(pane.invoked_with())) + .map(|(id, _)| *id) }) } @@ -3797,15 +3769,6 @@ pub fn pane_info_for_pane(pane_id: &PaneId, pane: &Box<dyn Pane>) -> PaneInfo { pane_info.plugin_url = pane.invoked_with().as_ref().and_then(|c| match c { Run::Plugin(run_plugin_or_alias) => { Some(run_plugin_or_alias.location_string()) -// match run_plugin_or_alias { -// RunPluginOrAlias::RunPlugin(run_plugin) => { -// Some(run_plugin.location.to_string()) -// } -// RunPluginOrAlias::Alias(alias) => { -// // TODO: handle alias -// unimplemented!() -// } -// } } _ => None, }); |