Repository: alacritty/alacritty (language: rust)

Issue:
Alacritty 13.x `-o` option improperly merges config settings
When using -o to override config options, alacritty 13 doesn't properly merge the new values into the existing config. This is a regression in 13; it worked properly in 12.x.

### System

OS: Linux
Version: alacritty 0.13.1
Linux/BSD: X11

### Logs

My config contains
```
[env]
WINIT_X11_SCALE_FACTOR = "randr"
```

But when I run `alacritty -o env.TERM=\"xterm-256color\"` with alacritty 13.x, `WINIT_X11_SCALE_FACTOR` is not set from the config.

### Steps to reproduce:
```
# If running from an existing alacritty session, unset it so it isn't inherited
unset WINIT_X11_SCALE_FACTOR
alacritty -o env.TERM=\"xterm-256color\"
```
then run `echo $WINIT_X11_SCALE_FACTOR` in the new terminal and see an empty string.

If running `alacritty -o env.TERM=xterm-256color` with alacritty 12.x, it works as expected and both environment variables are properly set.

#### Working example:
```
# If running from an existing alacritty session, unset it so it isn't inherited
unset WINIT_X11_SCALE_FACTOR
alacritty
```
then run `echo $WINIT_X11_SCALE_FACTOR` in the new terminal and see `randr`, read fresh from the config.



Discussion / hints:

Fix patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 01514ddeaf0..12df09f9172 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
 
 ### Fixed
 
+- CLI env variables clearing configuration file variables
 - Vi inline search/semantic selection expanding across newlines
 
 ## 0.13.1
diff --git a/alacritty_config/src/lib.rs b/alacritty_config/src/lib.rs
index 81e43bb8066..8da91e19e3a 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(())
     }
 }
 


Test patch: