diff options
author | Aram Drevekenin <aram@poor.dev> | 2023-06-07 12:43:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-07 12:43:35 +0200 |
commit | c11d75f9157873fc99fe0d40933de8ec5fbb4f6b (patch) | |
tree | fc55dc7f9132395585613dd9cce94c98c8c76600 /zellij-server/src/panes | |
parent | b8f095330a57c905f23563ca7c2bfae3171abf57 (diff) |
feat(wasm-plugin-system): major overhaul and some goodies (#2510)
* strider resiliency
* worker channel prototype
* finalized ui
* show hide plugin
* fs events to plugins
* tests for events and new screen instructions
* various refactoringz
* report plugin errors instead of crashing zellij
* fix plugin loading with workers
* refactor: move watch filesystem
* some fixes and refactoring
* refactor(panes): combine pane insertion logic
* refactor(screen): launch or focus
* refactor(pty): consolidate default shell fetching
* refactor: various cleanups
* initial refactoring
* more initial refactoring
* refactor(strider): search
* style(fmt): rustfmt
* style(pty): cleanup
* style(clippy): ok clippy
* style(fmt): rustfmt
Diffstat (limited to 'zellij-server/src/panes')
-rw-r--r-- | zellij-server/src/panes/floating_panes/mod.rs | 17 | ||||
-rw-r--r-- | zellij-server/src/panes/plugin_pane.rs | 2 | ||||
-rw-r--r-- | zellij-server/src/panes/tiled_panes/mod.rs | 20 |
3 files changed, 36 insertions, 3 deletions
diff --git a/zellij-server/src/panes/floating_panes/mod.rs b/zellij-server/src/panes/floating_panes/mod.rs index a85cf80fd..071f6e7c2 100644 --- a/zellij-server/src/panes/floating_panes/mod.rs +++ b/zellij-server/src/panes/floating_panes/mod.rs @@ -25,7 +25,7 @@ use zellij_utils::{ data::{ModeInfo, Style}, errors::prelude::*, input::command::RunCommand, - input::layout::FloatingPaneLayout, + input::layout::{FloatingPaneLayout, Run, RunPlugin}, pane_size::{Dimension, Offset, PaneGeom, Size, SizeInPixels, Viewport}, }; @@ -870,4 +870,19 @@ impl FloatingPanes { self.focus_pane_for_all_clients(active_pane_id); } } + pub fn get_plugin_pane_id(&self, run_plugin: &RunPlugin) -> Option<PaneId> { + let run = Some(Run::Plugin(run_plugin.clone())); + self.panes + .iter() + .find(|(_id, s_p)| s_p.invoked_with() == &run) + .map(|(id, _)| *id) + } + pub fn focus_pane_if_exists(&mut self, pane_id: PaneId, client_id: ClientId) -> Result<()> { + if self.panes.get(&pane_id).is_some() { + self.focus_pane(pane_id, client_id); + Ok(()) + } else { + Err(anyhow!("Pane not found")) + } + } } diff --git a/zellij-server/src/panes/plugin_pane.rs b/zellij-server/src/panes/plugin_pane.rs index 7915069c5..28fdb3d10 100644 --- a/zellij-server/src/panes/plugin_pane.rs +++ b/zellij-server/src/panes/plugin_pane.rs @@ -537,7 +537,7 @@ impl Pane for PluginPane { self.pane_title = title; } fn update_loading_indication(&mut self, loading_indication: LoadingIndication) { - if self.loading_indication.ended { + if self.loading_indication.ended && !loading_indication.is_error() { return; } self.loading_indication.merge(loading_indication); diff --git a/zellij-server/src/panes/tiled_panes/mod.rs b/zellij-server/src/panes/tiled_panes/mod.rs index 08a633b0a..3734214af 100644 --- a/zellij-server/src/panes/tiled_panes/mod.rs +++ b/zellij-server/src/panes/tiled_panes/mod.rs @@ -20,7 +20,10 @@ use stacked_panes::StackedPanes; use zellij_utils::{ data::{Direction, ModeInfo, ResizeStrategy, Style}, errors::prelude::*, - input::{command::RunCommand, layout::SplitDirection}, + input::{ + command::RunCommand, + layout::{Run, RunPlugin, SplitDirection}, + }, pane_size::{Offset, PaneGeom, Size, SizeInPixels, Viewport}, }; @@ -529,6 +532,14 @@ impl TiledPanes { } self.reset_boundaries(); } + pub fn focus_pane_if_exists(&mut self, pane_id: PaneId, client_id: ClientId) -> Result<()> { + if self.panes.get(&pane_id).is_some() { + self.focus_pane(pane_id, client_id); + Ok(()) + } else { + Err(anyhow!("Pane not found")) + } + } pub fn focus_pane_at_position(&mut self, position_and_size: PaneGeom, client_id: ClientId) { if let Some(pane_id) = self .panes @@ -1691,6 +1702,13 @@ impl TiledPanes { fn reset_boundaries(&mut self) { self.client_id_to_boundaries.clear(); } + pub fn get_plugin_pane_id(&self, run_plugin: &RunPlugin) -> Option<PaneId> { + let run = Some(Run::Plugin(run_plugin.clone())); + self.panes + .iter() + .find(|(_id, s_p)| s_p.invoked_with() == &run) + .map(|(id, _)| *id) + } } #[allow(clippy::borrowed_box)] |