Make Theme::default have a non-empty replica theme vector

Max Brunsfeld and Nathan Sobo created

Co-Authored-By: Nathan Sobo <nathan@zed.dev>

Change summary

zed/src/settings.rs | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)

Detailed changes

zed/src/settings.rs 🔗

@@ -75,7 +75,7 @@ pub struct UiTheme {
     pub modal_match_text_highlight: Color,
 }
 
-#[derive(Clone, Default, Deserialize)]
+#[derive(Clone, Deserialize)]
 #[serde(default)]
 pub struct EditorTheme {
     pub background: Color,
@@ -87,7 +87,7 @@ pub struct EditorTheme {
     pub replicas: Vec<ReplicaTheme>,
 }
 
-#[derive(Clone, Copy, Deserialize)]
+#[derive(Clone, Copy, Deserialize, Default)]
 pub struct ReplicaTheme {
     pub cursor: Color,
     pub selection: Color,
@@ -235,6 +235,20 @@ impl Theme {
     }
 }
 
+impl Default for EditorTheme {
+    fn default() -> Self {
+        Self {
+            background: Default::default(),
+            gutter_background: Default::default(),
+            active_line_background: Default::default(),
+            line_number: Default::default(),
+            line_number_active: Default::default(),
+            default_text: Default::default(),
+            replicas: vec![ReplicaTheme::default()],
+        }
+    }
+}
+
 impl ThemeMap {
     pub fn new(capture_names: &[String], theme: &Theme) -> Self {
         // For each capture name in the highlight query, find the longest