aboutsummaryrefslogtreecommitdiffstats
path: root/zellij-utils/src/input
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2023-08-25 18:28:15 +0200
committerGitHub <noreply@github.com>2023-08-25 18:28:15 +0200
commit8c2a4e8429a29c554a824dad30aa36c98b932003 (patch)
tree8d1ef2b9a1c69975bfee20f9a52fbc226843552c /zellij-utils/src/input
parentdocs(changelog): keybind run floating pane (diff)
downloadsl0ppij-8c2a4e8429a29c554a824dad30aa36c98b932003.tar.gz
sl0ppij-8c2a4e8429a29c554a824dad30aa36c98b932003.tar.xz
sl0ppij-8c2a4e8429a29c554a824dad30aa36c98b932003.zip
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
Diffstat (limited to 'zellij-utils/src/input')
-rw-r--r--zellij-utils/src/input/layout.rs24
1 files changed, 22 insertions, 2 deletions
diff --git a/zellij-utils/src/input/layout.rs b/zellij-utils/src/input/layout.rs
index bd0396a1..262f2778 100644
--- a/zellij-utils/src/input/layout.rs
+++ b/zellij-utils/src/input/layout.rs
@@ -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 {
#[serde(default)]
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)]
pub struct PluginUserConfiguration(BTreeMap<String, String>);
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)
}
pub fn inner(&self) -> &BTreeMap<String, String> {