1
0
Fork 0
mirror of https://github.com/alacritty/alacritty.git synced 2024-11-18 13:55:23 -05:00

Improve ability of alacritty to deal with broken config

Until now alacritty completely refuses to start when the config is broken
in any way. This behavior has been changed so the worst-case is always
that alacritty launches with the default configuration.

When part of the config is broken, alacritty shouldn't instantly try to
recover to the default config, but instead try to use defaults only for
the parts of the config which are broken. This has also been implemented
for most of the fields in the configuration. So it should be possible that
parts are broken, but the rest is still used for the configuration.

This fixes #954.
This commit is contained in:
Christian Duerr 2018-01-06 00:50:12 +00:00 committed by Christian Duerr
parent d40f3b04f0
commit 4cf18ef995
No known key found for this signature in database
GPG key ID: 85CDAE3C164BA7B4

View file

@ -176,6 +176,18 @@ fn default_visual_bell_color() -> Rgb {
Rgb { r: 255, g: 255, b: 255 }
}
fn deserialize_visual_bell_duration<'a, D>(deserializer: D) -> ::std::result::Result<u16, D::Error>
where D: de::Deserializer<'a>
{
match u16::deserialize(deserializer) {
Ok(duration) => Ok(duration),
Err(err) => {
eprintln!("problem with config: {}; Using default value", err);
Ok(default_visual_bell_duration())
},
}
}
impl VisualBellConfig {
/// Visual bell animation
#[inline]