Fix bug with cursor colors and old config
There was no default supplied for Colors.cursor. This caused config not specifying that property to break. Adding a default should fix that.
This commit is contained in:
parent
9f064001e2
commit
b27d1266d6
|
@ -706,11 +706,19 @@ pub enum Error {
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
pub struct Colors {
|
pub struct Colors {
|
||||||
primary: PrimaryColors,
|
primary: PrimaryColors,
|
||||||
|
#[serde(default="default_cursor_colors")]
|
||||||
cursor: PrimaryColors,
|
cursor: PrimaryColors,
|
||||||
normal: AnsiColors,
|
normal: AnsiColors,
|
||||||
bright: AnsiColors,
|
bright: AnsiColors,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn default_cursor_colors() -> PrimaryColors {
|
||||||
|
PrimaryColors {
|
||||||
|
foreground: Rgb { r: 0, g: 0, b: 0 },
|
||||||
|
background: Rgb { r: 0xff, g: 0xff, b: 0xff },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
pub struct PrimaryColors {
|
pub struct PrimaryColors {
|
||||||
#[serde(deserialize_with = "rgb_from_hex")]
|
#[serde(deserialize_with = "rgb_from_hex")]
|
||||||
|
@ -726,10 +734,7 @@ impl Default for Colors {
|
||||||
background: Rgb { r: 0, g: 0, b: 0 },
|
background: Rgb { r: 0, g: 0, b: 0 },
|
||||||
foreground: Rgb { r: 0xea, g: 0xea, b: 0xea },
|
foreground: Rgb { r: 0xea, g: 0xea, b: 0xea },
|
||||||
},
|
},
|
||||||
cursor: PrimaryColors {
|
cursor: default_cursor_colors(),
|
||||||
foreground: Rgb { r: 0, g: 0, b: 0 },
|
|
||||||
background: Rgb { r: 0xff, g: 0xff, b: 0xff },
|
|
||||||
},
|
|
||||||
normal: AnsiColors {
|
normal: AnsiColors {
|
||||||
black: Rgb {r: 0x00, g: 0x00, b: 0x00},
|
black: Rgb {r: 0x00, g: 0x00, b: 0x00},
|
||||||
red: Rgb {r: 0xd5, g: 0x4e, b: 0x53},
|
red: Rgb {r: 0xd5, g: 0x4e, b: 0x53},
|
||||||
|
|
Loading…
Reference in New Issue