Fix default hollow cursor behavior with empty conf

The 2c37da48b5 change introduced some
changes to the way cursor configuration is handled. However it did not
properly handle the default behavior of the hollow cursor when the
`cursor` field was not specified at all.

By implementing the `Default` trait for the `Cursor` struct in
`config.rs` manually, the default value of the `unfocused_hollow` field
has been corrected back to `true` when the `cursor` struct isn't present
at all.
This commit is contained in:
Christian Duerr 2018-11-01 20:50:32 +00:00 committed by GitHub
parent a846faa6ef
commit a3f729f589
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 1 deletions

View File

@ -1206,7 +1206,7 @@ fn deserialize_color_index<'a, D>(deserializer: D) -> ::std::result::Result<u8,
}
}
#[derive(Copy, Clone, Debug, Default, Deserialize)]
#[derive(Copy, Clone, Debug, Deserialize)]
pub struct Cursor {
#[serde(default, deserialize_with = "failure_default")]
pub style: CursorStyle,
@ -1214,6 +1214,15 @@ pub struct Cursor {
pub unfocused_hollow: bool,
}
impl Default for Cursor {
fn default() -> Self {
Self {
style: Default::default(),
unfocused_hollow: true,
}
}
}
#[derive(Debug, Copy, Clone, Default, Deserialize)]
pub struct CursorColors {
#[serde(default, deserialize_with = "deserialize_optional_color")]