diff options
author | Christian Duerr <contact@christianduerr.com> | 2023-06-15 10:59:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-15 08:59:12 +0000 |
commit | afffdbe612cb8b573016184400e0deeb0137ccb9 (patch) | |
tree | 3f79b638ec3e5c8f85f2ba784898ee1fa9034322 /alacritty/src | |
parent | be03effdbe5b5bdabfed50d87963e78017329182 (diff) | |
download | r-alacritty-afffdbe612cb8b573016184400e0deeb0137ccb9.tar.gz r-alacritty-afffdbe612cb8b573016184400e0deeb0137ccb9.tar.bz2 r-alacritty-afffdbe612cb8b573016184400e0deeb0137ccb9.zip |
Fix `alacritty msg config` toml replacement
This fixes a regression introduced in bd49067 which broke the override
of configuration file variables using `alacritty msg config`.
To fix this the `replace` functionality was rewritten to behave more
like the `serde_utils::merge` where entire values are inserted into the
existing structure rather than separating the keys from the values.
Fixes: bd49067 (Switch to TOML configuration format)
Diffstat (limited to 'alacritty/src')
-rw-r--r-- | alacritty/src/window_context.rs | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/alacritty/src/window_context.rs b/alacritty/src/window_context.rs index a450c77d..502907ad 100644 --- a/alacritty/src/window_context.rs +++ b/alacritty/src/window_context.rs @@ -70,7 +70,7 @@ pub struct WindowContext { master_fd: RawFd, #[cfg(not(windows))] shell_pid: u32, - ipc_config: Vec<(String, toml::Value)>, + ipc_config: Vec<toml::Value>, config: Rc<UiConfig>, } @@ -273,13 +273,12 @@ impl WindowContext { // Apply each option, removing broken ones. let mut i = 0; while i < self.ipc_config.len() { - let (key, value) = &self.ipc_config[i]; - - match config.replace(key, value.clone()) { + let option = &self.ipc_config[i]; + match config.replace(option.clone()) { Err(err) => { error!( target: LOG_TARGET_IPC_CONFIG, - "Unable to override option '{}': {}", key, err + "Unable to override option '{}': {}", option, err ); self.ipc_config.swap_remove(i); }, @@ -367,21 +366,9 @@ impl WindowContext { self.ipc_config.clear(); } else { for option in &ipc_config.options { - // Separate config key/value. - let (key, value) = match option.split_once('=') { - Some(split) => split, - None => { - error!( - target: LOG_TARGET_IPC_CONFIG, - "'{}': IPC config option missing value", option - ); - continue; - }, - }; - - // Try and parse value as toml. - match toml::from_str(value) { - Ok(value) => self.ipc_config.push((key.to_owned(), value)), + // Try and parse option as toml. + match toml::from_str(option) { + Ok(value) => self.ipc_config.push(value), Err(err) => error!( target: LOG_TARGET_IPC_CONFIG, "'{}': Invalid IPC config value: {:?}", option, err |