summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJoe Wilm <joe@jwilm.com>2017-01-30 09:45:09 -0800
committerJoe Wilm <joe@jwilm.com>2017-01-30 09:45:09 -0800
commitb27d1266d6d28912012dfb4e236a3ade4fd1c74a (patch)
treeb85e307428b9333156b46d154068f0bd9eed5108 /src
parent9f064001e20c55cd1b1bf5dfaeea7fd324cdae5d (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/config.rs13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/config.rs b/src/config.rs
index 7f5a5823..b8768c01 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -706,11 +706,19 @@ pub enum Error {
#[derive(Debug, Deserialize)]
pub struct Colors {
primary: PrimaryColors,
+ #[serde(default="default_cursor_colors")]
cursor: PrimaryColors,
normal: 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)]
pub struct PrimaryColors {
#[serde(deserialize_with = "rgb_from_hex")]
@@ -726,10 +734,7 @@ impl Default for Colors {
background: Rgb { r: 0, g: 0, b: 0 },
foreground: Rgb { r: 0xea, g: 0xea, b: 0xea },
},
- cursor: PrimaryColors {
- foreground: Rgb { r: 0, g: 0, b: 0 },
- background: Rgb { r: 0xff, g: 0xff, b: 0xff },
- },
+ cursor: default_cursor_colors(),
normal: AnsiColors {
black: Rgb {r: 0x00, g: 0x00, b: 0x00},
red: Rgb {r: 0xd5, g: 0x4e, b: 0x53},