summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2020-12-14 00:22:16 +0000
committerGitHub <noreply@github.com>2020-12-14 00:22:16 +0000
commit4de1048628c80e54d342c4cfa3675371f4824fec (patch)
tree604a03561936647026089a5a897b91fad6199261
parentf701b22c2d174faca83cfc0b786ba0bfd4b1724f (diff)
downloadalacritty-4de1048628c80e54d342c4cfa3675371f4824fec.tar.gz
alacritty-4de1048628c80e54d342c4cfa3675371f4824fec.zip
Fix live reload with broken yaml on start
Since the current behavior would just load the default configuration file whenever the configuration file couldn't be loaded, the path was not set to any value. As a result however, the live config reload feature would not work with a broken yaml (one which cannot be deserialized, not one with warnings). If a configuration file has been specified, but the deserialization still failed, the path is now preserved on the default configuration file to make it possible to live reload a fix for the issue. Fixes #4561.
-rw-r--r--CHANGELOG.md1
-rw-r--r--alacritty/src/config/mod.rs16
2 files changed, 11 insertions, 6 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fd096e62..b042f01c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -34,6 +34,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Window not being completely opaque on Windows
- Window being always on top during alt-tab on Windows
- Cursor position not reported to apps when mouse is moved with button held outside of window
+- No live config update when starting Alacritty with a broken configuration file
### Removed
diff --git a/alacritty/src/config/mod.rs b/alacritty/src/config/mod.rs
index 6fe58537..14afc7d1 100644
--- a/alacritty/src/config/mod.rs
+++ b/alacritty/src/config/mod.rs
@@ -100,17 +100,21 @@ pub fn load(options: &Options) -> Config {
let config_options = options.config_options().clone();
let config_path = options.config_path().or_else(installed_config);
- if config_path.is_none() {
- info!(target: LOG_TARGET_CONFIG, "No config file found; using default");
- }
-
// Load the config using the following fallback behavior:
// - Config path + CLI overrides
// - CLI overrides
// - Default
let mut config = config_path
- .and_then(|config_path| load_from(&config_path, config_options.clone()).ok())
- .unwrap_or_else(|| Config::deserialize(config_options).unwrap_or_default());
+ .as_ref()
+ .and_then(|config_path| load_from(config_path, config_options.clone()).ok())
+ .unwrap_or_else(|| {
+ let mut config = Config::deserialize(config_options).unwrap_or_default();
+ match config_path {
+ Some(config_path) => config.ui_config.config_paths.push(config_path),
+ None => info!(target: LOG_TARGET_CONFIG, "No config file found; using default"),
+ }
+ config
+ });
// Override config with CLI options.
options.override_config(&mut config);