aboutsummaryrefslogtreecommitdiff
path: root/alacritty_config
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2024-01-14 17:25:15 +0100
committerGitHub <noreply@github.com>2024-01-14 20:25:15 +0400
commit94ede16ee4af8869fd6415b3530c7e12c8681578 (patch)
treed1a298b6c1333ca37c88b8318ba06405004a0b08 /alacritty_config
parentb82a49ce0cc99ef40a1ef49b6f3b39ef598f42d1 (diff)
downloadalacritty-94ede16ee4af8869fd6415b3530c7e12c8681578.tar.gz
alacritty-94ede16ee4af8869fd6415b3530c7e12c8681578.zip
Fix env variable overrides through CLI
This fixes an issue where all CLI environment variables would replace existing configuration file variables instead of merging the two maps together. Fixes #7618.
Diffstat (limited to 'alacritty_config')
-rw-r--r--alacritty_config/src/lib.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/alacritty_config/src/lib.rs b/alacritty_config/src/lib.rs
index 81e43bb8..8da91e19 100644
--- a/alacritty_config/src/lib.rs
+++ b/alacritty_config/src/lib.rs
@@ -61,7 +61,15 @@ impl<'de, T: SerdeReplace + Deserialize<'de>> SerdeReplace for Option<T> {
impl<'de, T: Deserialize<'de>> SerdeReplace for HashMap<String, T> {
fn replace(&mut self, value: Value) -> Result<(), Box<dyn Error>> {
- replace_simple(self, value)
+ // Deserialize replacement as HashMap.
+ let hashmap: HashMap<String, T> = Self::deserialize(value)?;
+
+ // Merge the two HashMaps, replacing existing values.
+ for (key, value) in hashmap {
+ self.insert(key, value);
+ }
+
+ Ok(())
}
}