gpui: Fix blending of colors in HighlightStyle::highlight (#37666)
Whilst looking into adding support for RainbowBrackes, we stumbled upon this: Whereas for all properties during this blending, we take the value of `other` if it is set, for the color we actually take `self.color` instead of `other.color` if `self.color` is at full opacity. `Hsla::blend` returns the latter color if it is at full opacity, which seems wrong for this case. Hence, this PR swaps these. Will not merge before the next release, to ensure that we don't break something somewhere unexpected. Release Notes: - N/A
This commit is contained in:
@@ -150,11 +150,11 @@ impl<'a> Iterator for CustomHighlightsChunks<'a> {
|
||||
..chunk.clone()
|
||||
};
|
||||
if !self.active_highlights.is_empty() {
|
||||
let mut highlight_style = HighlightStyle::default();
|
||||
for active_highlight in self.active_highlights.values() {
|
||||
highlight_style.highlight(*active_highlight);
|
||||
}
|
||||
prefix.highlight_style = Some(highlight_style);
|
||||
prefix.highlight_style = self
|
||||
.active_highlights
|
||||
.values()
|
||||
.copied()
|
||||
.reduce(|acc, active_highlight| acc.highlight(active_highlight));
|
||||
}
|
||||
Some(prefix)
|
||||
}
|
||||
|
||||
@@ -385,9 +385,9 @@ impl<'a> Iterator for InlayChunks<'a> {
|
||||
next_inlay_highlight_endpoint = usize::MAX;
|
||||
} else {
|
||||
next_inlay_highlight_endpoint = range.end - offset_in_inlay.0;
|
||||
highlight_style
|
||||
.get_or_insert_with(Default::default)
|
||||
.highlight(*style);
|
||||
highlight_style = highlight_style
|
||||
.map(|highlight| highlight.highlight(*style))
|
||||
.or_else(|| Some(*style));
|
||||
}
|
||||
} else {
|
||||
next_inlay_highlight_endpoint = usize::MAX;
|
||||
|
||||
Reference in New Issue
Block a user