From 5685ce8bf8cb919f454518f1206b7ebc52636378 Mon Sep 17 00:00:00 2001 From: Christian Duerr Date: Tue, 2 Jan 2024 14:34:57 +0100 Subject: Fix replacing optional fields This fixes an issue with the default `SerdeReplace` implementation where it would never recurse through options but always replace the entire option with the new value. Closes #7518. --- alacritty/src/config/ui_config.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'alacritty/src/config/ui_config.rs') diff --git a/alacritty/src/config/ui_config.rs b/alacritty/src/config/ui_config.rs index f4f67cb6..21059734 100644 --- a/alacritty/src/config/ui_config.rs +++ b/alacritty/src/config/ui_config.rs @@ -1,9 +1,11 @@ use std::cell::RefCell; use std::collections::HashMap; +use std::error::Error; use std::fmt::{self, Formatter}; use std::path::PathBuf; use std::rc::Rc; +use alacritty_config::SerdeReplace; use alacritty_terminal::term::Config as TermConfig; use alacritty_terminal::tty::{Options as PtyOptions, Shell}; use log::{error, warn}; @@ -656,6 +658,14 @@ impl From for Shell { } } +impl SerdeReplace for Program { + fn replace(&mut self, value: toml::Value) -> Result<(), Box> { + *self = Self::deserialize(value)?; + + Ok(()) + } +} + pub(crate) struct StringVisitor; impl<'de> serde::de::Visitor<'de> for StringVisitor { type Value = String; -- cgit