Make all HighlightStyle properties optional
Previously, some of those properties such the font weight, style and color would be mandatory: when the theme didn't specify them, Zed would use a default value during deserialization. This meant that those default properties would unconditionally override the base text style, causing a rendering bug when combining syntax highlights with diagnostic styles. This commit fixes that by making `HighlightStyle`s more additive: each property can be set independently and only the properties that theme specifies get overridden in the base text style.
This commit is contained in:
@@ -397,7 +397,7 @@ impl EditorElement {
|
||||
RunStyle {
|
||||
font_id,
|
||||
color: style.background,
|
||||
underline: None,
|
||||
underline: Default::default(),
|
||||
},
|
||||
)],
|
||||
))
|
||||
@@ -555,7 +555,7 @@ impl EditorElement {
|
||||
RunStyle {
|
||||
font_id: style.text.font_id,
|
||||
color: Color::black(),
|
||||
underline: None,
|
||||
underline: Default::default(),
|
||||
},
|
||||
)],
|
||||
)
|
||||
@@ -596,7 +596,7 @@ impl EditorElement {
|
||||
RunStyle {
|
||||
font_id: style.text.font_id,
|
||||
color,
|
||||
underline: None,
|
||||
underline: Default::default(),
|
||||
},
|
||||
)],
|
||||
)));
|
||||
@@ -644,7 +644,7 @@ impl EditorElement {
|
||||
RunStyle {
|
||||
font_id: placeholder_style.font_id,
|
||||
color: placeholder_style.color,
|
||||
underline: None,
|
||||
underline: Default::default(),
|
||||
},
|
||||
)],
|
||||
)
|
||||
@@ -669,7 +669,7 @@ impl EditorElement {
|
||||
let diagnostic_style = super::diagnostic_style(severity, true, style);
|
||||
let diagnostic_highlight = HighlightStyle {
|
||||
underline: Some(Underline {
|
||||
color: diagnostic_style.message.text.color,
|
||||
color: Some(diagnostic_style.message.text.color),
|
||||
thickness: 1.0.into(),
|
||||
squiggly: true,
|
||||
}),
|
||||
@@ -1237,7 +1237,7 @@ fn layout_line(
|
||||
RunStyle {
|
||||
font_id: style.text.font_id,
|
||||
color: Color::black(),
|
||||
underline: None,
|
||||
underline: Default::default(),
|
||||
},
|
||||
)],
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user