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

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Max Brunsfeld 2021-08-02 13:09:43 -07:00
parent 92353b6967
commit 76c07fb232

View File

@ -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