aboutsummaryrefslogtreecommitdiff
path: root/alacritty/src/config/ui_config.rs
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2024-01-02 14:34:57 +0100
committerGitHub <noreply@github.com>2024-01-02 13:34:57 +0000
commit5685ce8bf8cb919f454518f1206b7ebc52636378 (patch)
treee20dde7f70bb06ad4edc277f2faa2b25ccf8938c /alacritty/src/config/ui_config.rs
parent8f57367eadeca92706193fc40030081f40e81fbf (diff)
downloadr-alacritty-5685ce8bf8cb919f454518f1206b7ebc52636378.tar.gz
r-alacritty-5685ce8bf8cb919f454518f1206b7ebc52636378.tar.bz2
r-alacritty-5685ce8bf8cb919f454518f1206b7ebc52636378.zip
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.
Diffstat (limited to 'alacritty/src/config/ui_config.rs')
-rw-r--r--alacritty/src/config/ui_config.rs10
1 files changed, 10 insertions, 0 deletions
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<Program> for Shell {
}
}
+impl SerdeReplace for Program {
+ fn replace(&mut self, value: toml::Value) -> Result<(), Box<dyn Error>> {
+ *self = Self::deserialize(value)?;
+
+ Ok(())
+ }
+}
+
pub(crate) struct StringVisitor;
impl<'de> serde::de::Visitor<'de> for StringVisitor {
type Value = String;