Avoid showing selection strip on top of diagnostic headers

This commit is contained in:
Max Brunsfeld 2022-01-25 17:29:08 -08:00
parent 51c34ebcc2
commit 9b9fcf6927
2 changed files with 26 additions and 23 deletions

View File

@ -855,32 +855,34 @@ impl Element for EditorElement {
layout: &mut Self::LayoutState,
cx: &mut PaintContext,
) -> Self::PaintState {
if let Some(layout) = layout {
cx.scene.push_layer(Some(bounds));
let layout = layout.as_mut()?;
cx.scene.push_layer(Some(bounds));
let gutter_bounds = RectF::new(bounds.origin(), layout.gutter_size);
let text_bounds = RectF::new(
bounds.origin() + vec2f(layout.gutter_size.x(), 0.0),
layout.text_size,
);
let gutter_bounds = RectF::new(bounds.origin(), layout.gutter_size);
let text_bounds = RectF::new(
bounds.origin() + vec2f(layout.gutter_size.x(), 0.0),
layout.text_size,
);
self.paint_background(gutter_bounds, text_bounds, layout, cx);
if layout.gutter_size.x() > 0. {
self.paint_gutter(gutter_bounds, visible_bounds, layout, cx);
}
self.paint_text(text_bounds, visible_bounds, layout, cx);
self.paint_blocks(bounds, visible_bounds, layout, cx);
cx.scene.pop_layer();
Some(PaintState {
bounds,
gutter_bounds,
text_bounds,
})
} else {
None
self.paint_background(gutter_bounds, text_bounds, layout, cx);
if layout.gutter_size.x() > 0. {
self.paint_gutter(gutter_bounds, visible_bounds, layout, cx);
}
self.paint_text(text_bounds, visible_bounds, layout, cx);
if !layout.blocks.is_empty() {
cx.scene.push_layer(Some(bounds));
self.paint_blocks(bounds, visible_bounds, layout, cx);
cx.scene.pop_layer();
}
cx.scene.pop_layer();
Some(PaintState {
bounds,
gutter_bounds,
text_bounds,
})
}
fn dispatch_event(

View File

@ -258,6 +258,7 @@ path = { extends = "$text.2", size = 14, margin.left = 12 }
text_scale_factor = 0.857
[editor.diagnostic_header]
background = "$editor.background"
border = { width = 1, top = true, bottom = true, color = "$border.1" }
code = { extends = "$text.2", size = 14, margin.left = 10 }
icon_width_factor = 1.5