fix(plugins): make sure configuration is also part of the plugin keys (#2727)
* fix(plugins): make sure configuration is also part of the plugin keys * no thanks clippy
This commit is contained in:
parent
759ab9102b
commit
8c2a4e8429
14 changed files with 153 additions and 66 deletions
|
|
@ -872,6 +872,11 @@ impl FloatingPanes {
|
||||||
}
|
}
|
||||||
pub fn get_plugin_pane_id(&self, run_plugin: &RunPlugin) -> Option<PaneId> {
|
pub fn get_plugin_pane_id(&self, run_plugin: &RunPlugin) -> Option<PaneId> {
|
||||||
let run = Some(Run::Plugin(run_plugin.clone()));
|
let run = Some(Run::Plugin(run_plugin.clone()));
|
||||||
|
let currently_running_invoked_with: Vec<Option<Run>> = self
|
||||||
|
.panes
|
||||||
|
.iter()
|
||||||
|
.map(|(_, p)| p.invoked_with().clone())
|
||||||
|
.collect();
|
||||||
self.panes
|
self.panes
|
||||||
.iter()
|
.iter()
|
||||||
.find(|(_id, s_p)| s_p.invoked_with() == &run)
|
.find(|(_id, s_p)| s_p.invoked_with() == &run)
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,10 @@ use zellij_utils::{
|
||||||
errors::{prelude::*, ContextType, PluginContext},
|
errors::{prelude::*, ContextType, PluginContext},
|
||||||
input::{
|
input::{
|
||||||
command::TerminalAction,
|
command::TerminalAction,
|
||||||
layout::{FloatingPaneLayout, Layout, Run, RunPlugin, RunPluginLocation, TiledPaneLayout},
|
layout::{
|
||||||
|
FloatingPaneLayout, Layout, PluginUserConfiguration, Run, RunPlugin, RunPluginLocation,
|
||||||
|
TiledPaneLayout,
|
||||||
|
},
|
||||||
plugins::PluginsConfig,
|
plugins::PluginsConfig,
|
||||||
},
|
},
|
||||||
ipc::ClientAttributes,
|
ipc::ClientAttributes,
|
||||||
|
|
@ -225,7 +228,10 @@ pub(crate) fn plugin_thread_main(
|
||||||
tab_index,
|
tab_index,
|
||||||
client_id,
|
client_id,
|
||||||
) => {
|
) => {
|
||||||
let mut plugin_ids: HashMap<RunPluginLocation, Vec<PluginId>> = HashMap::new();
|
let mut plugin_ids: HashMap<
|
||||||
|
(RunPluginLocation, PluginUserConfiguration),
|
||||||
|
Vec<PluginId>,
|
||||||
|
> = HashMap::new();
|
||||||
let mut extracted_run_instructions = tab_layout
|
let mut extracted_run_instructions = tab_layout
|
||||||
.clone()
|
.clone()
|
||||||
.unwrap_or_else(|| layout.new_tab().0)
|
.unwrap_or_else(|| layout.new_tab().0)
|
||||||
|
|
@ -246,7 +252,10 @@ pub(crate) fn plugin_thread_main(
|
||||||
if let Some(Run::Plugin(run)) = run_instruction {
|
if let Some(Run::Plugin(run)) = run_instruction {
|
||||||
let plugin_id =
|
let plugin_id =
|
||||||
wasm_bridge.load_plugin(&run, tab_index, size, Some(client_id))?;
|
wasm_bridge.load_plugin(&run, tab_index, size, Some(client_id))?;
|
||||||
plugin_ids.entry(run.location).or_default().push(plugin_id);
|
plugin_ids
|
||||||
|
.entry((run.location, run.configuration))
|
||||||
|
.or_default()
|
||||||
|
.push(plugin_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
drop(bus.senders.send_to_pty(PtyInstruction::NewTab(
|
drop(bus.senders.send_to_pty(PtyInstruction::NewTab(
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,10 @@ use zellij_utils::{
|
||||||
errors::{ContextType, PtyContext},
|
errors::{ContextType, PtyContext},
|
||||||
input::{
|
input::{
|
||||||
command::{RunCommand, TerminalAction},
|
command::{RunCommand, TerminalAction},
|
||||||
layout::{FloatingPaneLayout, Layout, Run, RunPluginLocation, TiledPaneLayout},
|
layout::{
|
||||||
|
FloatingPaneLayout, Layout, PluginUserConfiguration, Run, RunPluginLocation,
|
||||||
|
TiledPaneLayout,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -52,8 +55,8 @@ pub enum PtyInstruction {
|
||||||
Option<TerminalAction>,
|
Option<TerminalAction>,
|
||||||
Option<TiledPaneLayout>,
|
Option<TiledPaneLayout>,
|
||||||
Vec<FloatingPaneLayout>,
|
Vec<FloatingPaneLayout>,
|
||||||
usize, // tab_index
|
usize, // tab_index
|
||||||
HashMap<RunPluginLocation, Vec<u32>>, // plugin_ids
|
HashMap<(RunPluginLocation, PluginUserConfiguration), Vec<u32>>, // plugin_ids
|
||||||
ClientId,
|
ClientId,
|
||||||
), // the String is the tab name
|
), // the String is the tab name
|
||||||
ClosePane(PaneId),
|
ClosePane(PaneId),
|
||||||
|
|
@ -595,7 +598,7 @@ impl Pty {
|
||||||
layout: TiledPaneLayout,
|
layout: TiledPaneLayout,
|
||||||
floating_panes_layout: Vec<FloatingPaneLayout>,
|
floating_panes_layout: Vec<FloatingPaneLayout>,
|
||||||
default_shell: Option<TerminalAction>,
|
default_shell: Option<TerminalAction>,
|
||||||
plugin_ids: HashMap<RunPluginLocation, Vec<u32>>,
|
plugin_ids: HashMap<(RunPluginLocation, PluginUserConfiguration), Vec<u32>>,
|
||||||
tab_index: usize,
|
tab_index: usize,
|
||||||
client_id: ClientId,
|
client_id: ClientId,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,8 @@ use zellij_utils::pane_size::{Size, SizeInPixels};
|
||||||
use zellij_utils::{
|
use zellij_utils::{
|
||||||
input::command::TerminalAction,
|
input::command::TerminalAction,
|
||||||
input::layout::{
|
input::layout::{
|
||||||
FloatingPaneLayout, Layout, Run, RunPlugin, RunPluginLocation, SwapFloatingLayout,
|
FloatingPaneLayout, Layout, PluginUserConfiguration, Run, RunPlugin, RunPluginLocation,
|
||||||
SwapTiledLayout, TiledPaneLayout,
|
SwapFloatingLayout, SwapTiledLayout, TiledPaneLayout,
|
||||||
},
|
},
|
||||||
position::Position,
|
position::Position,
|
||||||
};
|
};
|
||||||
|
|
@ -208,7 +208,7 @@ pub enum ScreenInstruction {
|
||||||
Vec<FloatingPaneLayout>,
|
Vec<FloatingPaneLayout>,
|
||||||
Vec<(u32, HoldForCommand)>, // new pane pids
|
Vec<(u32, HoldForCommand)>, // new pane pids
|
||||||
Vec<(u32, HoldForCommand)>, // new floating pane pids
|
Vec<(u32, HoldForCommand)>, // new floating pane pids
|
||||||
HashMap<RunPluginLocation, Vec<u32>>,
|
HashMap<(RunPluginLocation, PluginUserConfiguration), Vec<u32>>,
|
||||||
usize, // tab_index
|
usize, // tab_index
|
||||||
ClientId,
|
ClientId,
|
||||||
),
|
),
|
||||||
|
|
@ -1125,7 +1125,7 @@ impl Screen {
|
||||||
floating_panes_layout: Vec<FloatingPaneLayout>,
|
floating_panes_layout: Vec<FloatingPaneLayout>,
|
||||||
new_terminal_ids: Vec<(u32, HoldForCommand)>,
|
new_terminal_ids: Vec<(u32, HoldForCommand)>,
|
||||||
new_floating_terminal_ids: Vec<(u32, HoldForCommand)>,
|
new_floating_terminal_ids: Vec<(u32, HoldForCommand)>,
|
||||||
new_plugin_ids: HashMap<RunPluginLocation, Vec<u32>>,
|
new_plugin_ids: HashMap<(RunPluginLocation, PluginUserConfiguration), Vec<u32>>,
|
||||||
tab_index: usize,
|
tab_index: usize,
|
||||||
client_id: ClientId,
|
client_id: ClientId,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,9 @@ use std::collections::{BTreeMap, HashMap, HashSet};
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use zellij_utils::{
|
use zellij_utils::{
|
||||||
data::{Palette, Style},
|
data::{Palette, Style},
|
||||||
input::layout::{FloatingPaneLayout, Run, RunPluginLocation, TiledPaneLayout},
|
input::layout::{
|
||||||
|
FloatingPaneLayout, PluginUserConfiguration, Run, RunPluginLocation, TiledPaneLayout,
|
||||||
|
},
|
||||||
pane_size::{Offset, PaneGeom, Size, SizeInPixels, Viewport},
|
pane_size::{Offset, PaneGeom, Size, SizeInPixels, Viewport},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -96,7 +98,7 @@ impl<'a> LayoutApplier<'a> {
|
||||||
floating_panes_layout: Vec<FloatingPaneLayout>,
|
floating_panes_layout: Vec<FloatingPaneLayout>,
|
||||||
new_terminal_ids: Vec<(u32, HoldForCommand)>,
|
new_terminal_ids: Vec<(u32, HoldForCommand)>,
|
||||||
new_floating_terminal_ids: Vec<(u32, HoldForCommand)>,
|
new_floating_terminal_ids: Vec<(u32, HoldForCommand)>,
|
||||||
mut new_plugin_ids: HashMap<RunPluginLocation, Vec<u32>>,
|
mut new_plugin_ids: HashMap<(RunPluginLocation, PluginUserConfiguration), Vec<u32>>,
|
||||||
client_id: ClientId,
|
client_id: ClientId,
|
||||||
) -> Result<bool> {
|
) -> Result<bool> {
|
||||||
// true => layout has floating panes
|
// true => layout has floating panes
|
||||||
|
|
@ -198,7 +200,7 @@ impl<'a> LayoutApplier<'a> {
|
||||||
&mut self,
|
&mut self,
|
||||||
layout: TiledPaneLayout,
|
layout: TiledPaneLayout,
|
||||||
new_terminal_ids: Vec<(u32, HoldForCommand)>,
|
new_terminal_ids: Vec<(u32, HoldForCommand)>,
|
||||||
new_plugin_ids: &mut HashMap<RunPluginLocation, Vec<u32>>,
|
new_plugin_ids: &mut HashMap<(RunPluginLocation, PluginUserConfiguration), Vec<u32>>,
|
||||||
client_id: ClientId,
|
client_id: ClientId,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let err_context = || format!("failed to apply tiled panes layout");
|
let err_context = || format!("failed to apply tiled panes layout");
|
||||||
|
|
@ -230,7 +232,7 @@ impl<'a> LayoutApplier<'a> {
|
||||||
} else if let Some(Run::Plugin(run)) = layout.run.clone() {
|
} else if let Some(Run::Plugin(run)) = layout.run.clone() {
|
||||||
let pane_title = run.location.to_string();
|
let pane_title = run.location.to_string();
|
||||||
let pid = new_plugin_ids
|
let pid = new_plugin_ids
|
||||||
.get_mut(&run.location)
|
.get_mut(&(run.location, run.configuration))
|
||||||
.and_then(|ids| ids.pop())
|
.and_then(|ids| ids.pop())
|
||||||
.with_context(err_context)?;
|
.with_context(err_context)?;
|
||||||
let mut new_plugin = PluginPane::new(
|
let mut new_plugin = PluginPane::new(
|
||||||
|
|
@ -324,7 +326,7 @@ impl<'a> LayoutApplier<'a> {
|
||||||
&mut self,
|
&mut self,
|
||||||
floating_panes_layout: Vec<FloatingPaneLayout>,
|
floating_panes_layout: Vec<FloatingPaneLayout>,
|
||||||
new_floating_terminal_ids: Vec<(u32, HoldForCommand)>,
|
new_floating_terminal_ids: Vec<(u32, HoldForCommand)>,
|
||||||
new_plugin_ids: &mut HashMap<RunPluginLocation, Vec<u32>>,
|
new_plugin_ids: &mut HashMap<(RunPluginLocation, PluginUserConfiguration), Vec<u32>>,
|
||||||
layout_name: Option<String>,
|
layout_name: Option<String>,
|
||||||
) -> Result<bool> {
|
) -> Result<bool> {
|
||||||
// true => has floating panes
|
// true => has floating panes
|
||||||
|
|
@ -346,7 +348,7 @@ impl<'a> LayoutApplier<'a> {
|
||||||
} else if let Some(Run::Plugin(run)) = floating_pane_layout.run.clone() {
|
} else if let Some(Run::Plugin(run)) = floating_pane_layout.run.clone() {
|
||||||
let pane_title = run.location.to_string();
|
let pane_title = run.location.to_string();
|
||||||
let pid = new_plugin_ids
|
let pid = new_plugin_ids
|
||||||
.get_mut(&run.location)
|
.get_mut(&(run.location, run.configuration))
|
||||||
.and_then(|ids| ids.pop())
|
.and_then(|ids| ids.pop())
|
||||||
.with_context(err_context)?;
|
.with_context(err_context)?;
|
||||||
let mut new_pane = PluginPane::new(
|
let mut new_pane = PluginPane::new(
|
||||||
|
|
|
||||||
|
|
@ -49,8 +49,8 @@ use zellij_utils::{
|
||||||
input::{
|
input::{
|
||||||
command::TerminalAction,
|
command::TerminalAction,
|
||||||
layout::{
|
layout::{
|
||||||
FloatingPaneLayout, Run, RunPlugin, RunPluginLocation, SwapFloatingLayout,
|
FloatingPaneLayout, PluginUserConfiguration, Run, RunPlugin, RunPluginLocation,
|
||||||
SwapTiledLayout, TiledPaneLayout,
|
SwapFloatingLayout, SwapTiledLayout, TiledPaneLayout,
|
||||||
},
|
},
|
||||||
parse_keys,
|
parse_keys,
|
||||||
},
|
},
|
||||||
|
|
@ -621,7 +621,7 @@ impl Tab {
|
||||||
floating_panes_layout: Vec<FloatingPaneLayout>,
|
floating_panes_layout: Vec<FloatingPaneLayout>,
|
||||||
new_terminal_ids: Vec<(u32, HoldForCommand)>,
|
new_terminal_ids: Vec<(u32, HoldForCommand)>,
|
||||||
new_floating_terminal_ids: Vec<(u32, HoldForCommand)>,
|
new_floating_terminal_ids: Vec<(u32, HoldForCommand)>,
|
||||||
new_plugin_ids: HashMap<RunPluginLocation, Vec<u32>>,
|
new_plugin_ids: HashMap<(RunPluginLocation, PluginUserConfiguration), Vec<u32>>,
|
||||||
client_id: ClientId,
|
client_id: ClientId,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
self.swap_layouts
|
self.swap_layouts
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,8 @@ use zellij_utils::data::ResizeStrategy;
|
||||||
use zellij_utils::envs::set_session_name;
|
use zellij_utils::envs::set_session_name;
|
||||||
use zellij_utils::errors::{prelude::*, ErrorContext};
|
use zellij_utils::errors::{prelude::*, ErrorContext};
|
||||||
use zellij_utils::input::layout::{
|
use zellij_utils::input::layout::{
|
||||||
FloatingPaneLayout, Layout, RunPluginLocation, SwapFloatingLayout, SwapTiledLayout,
|
FloatingPaneLayout, Layout, PluginUserConfiguration, RunPluginLocation, SwapFloatingLayout,
|
||||||
TiledPaneLayout,
|
SwapTiledLayout, TiledPaneLayout,
|
||||||
};
|
};
|
||||||
use zellij_utils::input::plugins::PluginTag;
|
use zellij_utils::input::plugins::PluginTag;
|
||||||
use zellij_utils::ipc::IpcReceiverWithContext;
|
use zellij_utils::ipc::IpcReceiverWithContext;
|
||||||
|
|
@ -268,7 +268,7 @@ fn create_new_tab_with_swap_layouts(
|
||||||
Vec<FloatingPaneLayout>,
|
Vec<FloatingPaneLayout>,
|
||||||
Vec<(u32, Option<RunCommand>)>,
|
Vec<(u32, Option<RunCommand>)>,
|
||||||
Vec<(u32, Option<RunCommand>)>,
|
Vec<(u32, Option<RunCommand>)>,
|
||||||
HashMap<RunPluginLocation, Vec<u32>>,
|
HashMap<(RunPluginLocation, PluginUserConfiguration), Vec<u32>>,
|
||||||
)>,
|
)>,
|
||||||
draw_pane_frames: bool,
|
draw_pane_frames: bool,
|
||||||
) -> Tab {
|
) -> Tab {
|
||||||
|
|
@ -4955,11 +4955,17 @@ fn layout_with_plugins_and_commands_swaped_properly() {
|
||||||
let new_floating_terminal_ids = vec![];
|
let new_floating_terminal_ids = vec![];
|
||||||
let mut new_plugin_ids = HashMap::new();
|
let mut new_plugin_ids = HashMap::new();
|
||||||
new_plugin_ids.insert(
|
new_plugin_ids.insert(
|
||||||
RunPluginLocation::Zellij(PluginTag::new("tab-bar")),
|
(
|
||||||
|
RunPluginLocation::Zellij(PluginTag::new("tab-bar")),
|
||||||
|
Default::default(),
|
||||||
|
),
|
||||||
vec![1],
|
vec![1],
|
||||||
);
|
);
|
||||||
new_plugin_ids.insert(
|
new_plugin_ids.insert(
|
||||||
RunPluginLocation::Zellij(PluginTag::new("status-bar")),
|
(
|
||||||
|
RunPluginLocation::Zellij(PluginTag::new("status-bar")),
|
||||||
|
Default::default(),
|
||||||
|
),
|
||||||
vec![2],
|
vec![2],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -5050,11 +5056,17 @@ fn base_layout_is_included_in_swap_layouts() {
|
||||||
let new_floating_terminal_ids = vec![];
|
let new_floating_terminal_ids = vec![];
|
||||||
let mut new_plugin_ids = HashMap::new();
|
let mut new_plugin_ids = HashMap::new();
|
||||||
new_plugin_ids.insert(
|
new_plugin_ids.insert(
|
||||||
RunPluginLocation::Zellij(PluginTag::new("tab-bar")),
|
(
|
||||||
|
RunPluginLocation::Zellij(PluginTag::new("tab-bar")),
|
||||||
|
Default::default(),
|
||||||
|
),
|
||||||
vec![1],
|
vec![1],
|
||||||
);
|
);
|
||||||
new_plugin_ids.insert(
|
new_plugin_ids.insert(
|
||||||
RunPluginLocation::Zellij(PluginTag::new("status-bar")),
|
(
|
||||||
|
RunPluginLocation::Zellij(PluginTag::new("status-bar")),
|
||||||
|
Default::default(),
|
||||||
|
),
|
||||||
vec![2],
|
vec![2],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -5142,11 +5154,17 @@ fn swap_layouts_including_command_panes_absent_from_existing_layout() {
|
||||||
let new_floating_terminal_ids = vec![];
|
let new_floating_terminal_ids = vec![];
|
||||||
let mut new_plugin_ids = HashMap::new();
|
let mut new_plugin_ids = HashMap::new();
|
||||||
new_plugin_ids.insert(
|
new_plugin_ids.insert(
|
||||||
RunPluginLocation::Zellij(PluginTag::new("tab-bar")),
|
(
|
||||||
|
RunPluginLocation::Zellij(PluginTag::new("tab-bar")),
|
||||||
|
Default::default(),
|
||||||
|
),
|
||||||
vec![1],
|
vec![1],
|
||||||
);
|
);
|
||||||
new_plugin_ids.insert(
|
new_plugin_ids.insert(
|
||||||
RunPluginLocation::Zellij(PluginTag::new("status-bar")),
|
(
|
||||||
|
RunPluginLocation::Zellij(PluginTag::new("status-bar")),
|
||||||
|
Default::default(),
|
||||||
|
),
|
||||||
vec![2],
|
vec![2],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -5237,11 +5255,17 @@ fn swap_layouts_not_including_command_panes_present_in_existing_layout() {
|
||||||
let new_floating_terminal_ids = vec![];
|
let new_floating_terminal_ids = vec![];
|
||||||
let mut new_plugin_ids = HashMap::new();
|
let mut new_plugin_ids = HashMap::new();
|
||||||
new_plugin_ids.insert(
|
new_plugin_ids.insert(
|
||||||
RunPluginLocation::Zellij(PluginTag::new("tab-bar")),
|
(
|
||||||
|
RunPluginLocation::Zellij(PluginTag::new("tab-bar")),
|
||||||
|
Default::default(),
|
||||||
|
),
|
||||||
vec![1],
|
vec![1],
|
||||||
);
|
);
|
||||||
new_plugin_ids.insert(
|
new_plugin_ids.insert(
|
||||||
RunPluginLocation::Zellij(PluginTag::new("status-bar")),
|
(
|
||||||
|
RunPluginLocation::Zellij(PluginTag::new("status-bar")),
|
||||||
|
Default::default(),
|
||||||
|
),
|
||||||
vec![2],
|
vec![2],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -5405,11 +5429,17 @@ fn swap_layouts_not_including_plugin_panes_present_in_existing_layout() {
|
||||||
let new_floating_terminal_ids = vec![];
|
let new_floating_terminal_ids = vec![];
|
||||||
let mut new_plugin_ids = HashMap::new();
|
let mut new_plugin_ids = HashMap::new();
|
||||||
new_plugin_ids.insert(
|
new_plugin_ids.insert(
|
||||||
RunPluginLocation::Zellij(PluginTag::new("tab-bar")),
|
(
|
||||||
|
RunPluginLocation::Zellij(PluginTag::new("tab-bar")),
|
||||||
|
Default::default(),
|
||||||
|
),
|
||||||
vec![1],
|
vec![1],
|
||||||
);
|
);
|
||||||
new_plugin_ids.insert(
|
new_plugin_ids.insert(
|
||||||
RunPluginLocation::Zellij(PluginTag::new("status-bar")),
|
(
|
||||||
|
RunPluginLocation::Zellij(PluginTag::new("status-bar")),
|
||||||
|
Default::default(),
|
||||||
|
),
|
||||||
vec![2],
|
vec![2],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -5889,11 +5919,17 @@ fn floating_layout_with_plugins_and_commands_swaped_properly() {
|
||||||
let new_terminal_ids = vec![(4, None)];
|
let new_terminal_ids = vec![(4, None)];
|
||||||
let mut new_plugin_ids = HashMap::new();
|
let mut new_plugin_ids = HashMap::new();
|
||||||
new_plugin_ids.insert(
|
new_plugin_ids.insert(
|
||||||
RunPluginLocation::Zellij(PluginTag::new("tab-bar")),
|
(
|
||||||
|
RunPluginLocation::Zellij(PluginTag::new("tab-bar")),
|
||||||
|
Default::default(),
|
||||||
|
),
|
||||||
vec![1],
|
vec![1],
|
||||||
);
|
);
|
||||||
new_plugin_ids.insert(
|
new_plugin_ids.insert(
|
||||||
RunPluginLocation::Zellij(PluginTag::new("status-bar")),
|
(
|
||||||
|
RunPluginLocation::Zellij(PluginTag::new("status-bar")),
|
||||||
|
Default::default(),
|
||||||
|
),
|
||||||
vec![2],
|
vec![2],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -5982,11 +6018,17 @@ fn base_floating_layout_is_included_in_swap_layouts() {
|
||||||
let new_terminal_ids = vec![(4, None)];
|
let new_terminal_ids = vec![(4, None)];
|
||||||
let mut new_plugin_ids = HashMap::new();
|
let mut new_plugin_ids = HashMap::new();
|
||||||
new_plugin_ids.insert(
|
new_plugin_ids.insert(
|
||||||
RunPluginLocation::Zellij(PluginTag::new("tab-bar")),
|
(
|
||||||
|
RunPluginLocation::Zellij(PluginTag::new("tab-bar")),
|
||||||
|
Default::default(),
|
||||||
|
),
|
||||||
vec![1],
|
vec![1],
|
||||||
);
|
);
|
||||||
new_plugin_ids.insert(
|
new_plugin_ids.insert(
|
||||||
RunPluginLocation::Zellij(PluginTag::new("status-bar")),
|
(
|
||||||
|
RunPluginLocation::Zellij(PluginTag::new("status-bar")),
|
||||||
|
Default::default(),
|
||||||
|
),
|
||||||
vec![2],
|
vec![2],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -6074,11 +6116,17 @@ fn swap_floating_layouts_including_command_panes_absent_from_existing_layout() {
|
||||||
let new_terminal_ids = vec![(4, None)];
|
let new_terminal_ids = vec![(4, None)];
|
||||||
let mut new_plugin_ids = HashMap::new();
|
let mut new_plugin_ids = HashMap::new();
|
||||||
new_plugin_ids.insert(
|
new_plugin_ids.insert(
|
||||||
RunPluginLocation::Zellij(PluginTag::new("tab-bar")),
|
(
|
||||||
|
RunPluginLocation::Zellij(PluginTag::new("tab-bar")),
|
||||||
|
Default::default(),
|
||||||
|
),
|
||||||
vec![1],
|
vec![1],
|
||||||
);
|
);
|
||||||
new_plugin_ids.insert(
|
new_plugin_ids.insert(
|
||||||
RunPluginLocation::Zellij(PluginTag::new("status-bar")),
|
(
|
||||||
|
RunPluginLocation::Zellij(PluginTag::new("status-bar")),
|
||||||
|
Default::default(),
|
||||||
|
),
|
||||||
vec![2],
|
vec![2],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -6169,11 +6217,17 @@ fn swap_floating_layouts_not_including_command_panes_present_in_existing_layout(
|
||||||
let new_terminal_ids = vec![(4, None)];
|
let new_terminal_ids = vec![(4, None)];
|
||||||
let mut new_plugin_ids = HashMap::new();
|
let mut new_plugin_ids = HashMap::new();
|
||||||
new_plugin_ids.insert(
|
new_plugin_ids.insert(
|
||||||
RunPluginLocation::Zellij(PluginTag::new("tab-bar")),
|
(
|
||||||
|
RunPluginLocation::Zellij(PluginTag::new("tab-bar")),
|
||||||
|
Default::default(),
|
||||||
|
),
|
||||||
vec![1],
|
vec![1],
|
||||||
);
|
);
|
||||||
new_plugin_ids.insert(
|
new_plugin_ids.insert(
|
||||||
RunPluginLocation::Zellij(PluginTag::new("status-bar")),
|
(
|
||||||
|
RunPluginLocation::Zellij(PluginTag::new("status-bar")),
|
||||||
|
Default::default(),
|
||||||
|
),
|
||||||
vec![2],
|
vec![2],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -6326,11 +6380,17 @@ fn swap_floating_layouts_not_including_plugin_panes_present_in_existing_layout()
|
||||||
let new_terminal_ids = vec![(4, None)];
|
let new_terminal_ids = vec![(4, None)];
|
||||||
let mut new_plugin_ids = HashMap::new();
|
let mut new_plugin_ids = HashMap::new();
|
||||||
new_plugin_ids.insert(
|
new_plugin_ids.insert(
|
||||||
RunPluginLocation::Zellij(PluginTag::new("tab-bar")),
|
(
|
||||||
|
RunPluginLocation::Zellij(PluginTag::new("tab-bar")),
|
||||||
|
Default::default(),
|
||||||
|
),
|
||||||
vec![1],
|
vec![1],
|
||||||
);
|
);
|
||||||
new_plugin_ids.insert(
|
new_plugin_ids.insert(
|
||||||
RunPluginLocation::Zellij(PluginTag::new("status-bar")),
|
(
|
||||||
|
RunPluginLocation::Zellij(PluginTag::new("status-bar")),
|
||||||
|
Default::default(),
|
||||||
|
),
|
||||||
vec![2],
|
vec![2],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -311,7 +311,10 @@ impl MockScreen {
|
||||||
let mut floating_pane_ids = vec![];
|
let mut floating_pane_ids = vec![];
|
||||||
let mut plugin_ids = HashMap::new();
|
let mut plugin_ids = HashMap::new();
|
||||||
plugin_ids.insert(
|
plugin_ids.insert(
|
||||||
RunPluginLocation::File(PathBuf::from("/path/to/fake/plugin")),
|
(
|
||||||
|
RunPluginLocation::File(PathBuf::from("/path/to/fake/plugin")),
|
||||||
|
Default::default(),
|
||||||
|
),
|
||||||
vec![1],
|
vec![1],
|
||||||
);
|
);
|
||||||
for i in 0..pane_count {
|
for i in 0..pane_count {
|
||||||
|
|
|
||||||
|
|
@ -207,7 +207,8 @@ impl Run {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash, Default)]
|
#[allow(clippy::derive_hash_xor_eq)]
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Clone, Hash, Default)]
|
||||||
pub struct RunPlugin {
|
pub struct RunPlugin {
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub _allow_exec_host_cmd: bool,
|
pub _allow_exec_host_cmd: bool,
|
||||||
|
|
@ -225,11 +226,30 @@ impl RunPlugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::derive_hash_xor_eq)]
|
||||||
|
impl PartialEq for RunPlugin {
|
||||||
|
fn eq(&self, other: &Self) -> bool {
|
||||||
|
// TODO: normalize paths here if the location is a file so that relative/absolute paths
|
||||||
|
// will work properly
|
||||||
|
(&self.location, &self.configuration) == (&other.location, &other.configuration)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl Eq for RunPlugin {}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq, Eq, Hash)]
|
#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq, Eq, Hash)]
|
||||||
pub struct PluginUserConfiguration(BTreeMap<String, String>);
|
pub struct PluginUserConfiguration(BTreeMap<String, String>);
|
||||||
|
|
||||||
impl PluginUserConfiguration {
|
impl PluginUserConfiguration {
|
||||||
pub fn new(configuration: BTreeMap<String, String>) -> Self {
|
pub fn new(mut configuration: BTreeMap<String, String>) -> Self {
|
||||||
|
// reserved words
|
||||||
|
configuration.remove("hold_on_close");
|
||||||
|
configuration.remove("hold_on_start");
|
||||||
|
configuration.remove("cwd");
|
||||||
|
configuration.remove("name");
|
||||||
|
configuration.remove("direction");
|
||||||
|
configuration.remove("floating");
|
||||||
|
configuration.remove("move_to_focused_tab");
|
||||||
|
|
||||||
PluginUserConfiguration(configuration)
|
PluginUserConfiguration(configuration)
|
||||||
}
|
}
|
||||||
pub fn inner(&self) -> &BTreeMap<String, String> {
|
pub fn inner(&self) -> &BTreeMap<String, String> {
|
||||||
|
|
|
||||||
|
|
@ -2501,10 +2501,7 @@ Config {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
configuration: PluginUserConfiguration(
|
configuration: PluginUserConfiguration(
|
||||||
{
|
{},
|
||||||
"floating": "true",
|
|
||||||
"move_to_focused_tab": "true",
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
true,
|
true,
|
||||||
|
|
|
||||||
|
|
@ -2501,10 +2501,7 @@ Config {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
configuration: PluginUserConfiguration(
|
configuration: PluginUserConfiguration(
|
||||||
{
|
{},
|
||||||
"floating": "true",
|
|
||||||
"move_to_focused_tab": "true",
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
true,
|
true,
|
||||||
|
|
|
||||||
|
|
@ -2501,10 +2501,7 @@ Config {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
configuration: PluginUserConfiguration(
|
configuration: PluginUserConfiguration(
|
||||||
{
|
{},
|
||||||
"floating": "true",
|
|
||||||
"move_to_focused_tab": "true",
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
true,
|
true,
|
||||||
|
|
|
||||||
|
|
@ -2501,10 +2501,7 @@ Config {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
configuration: PluginUserConfiguration(
|
configuration: PluginUserConfiguration(
|
||||||
{
|
{},
|
||||||
"floating": "true",
|
|
||||||
"move_to_focused_tab": "true",
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
true,
|
true,
|
||||||
|
|
|
||||||
|
|
@ -2501,10 +2501,7 @@ Config {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
configuration: PluginUserConfiguration(
|
configuration: PluginUserConfiguration(
|
||||||
{
|
{},
|
||||||
"floating": "true",
|
|
||||||
"move_to_focused_tab": "true",
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
true,
|
true,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue