diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs index db67903e57..f1af1b4ce8 100644 --- a/crates/editor/src/element.rs +++ b/crates/editor/src/element.rs @@ -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( diff --git a/crates/zed/assets/themes/_base.toml b/crates/zed/assets/themes/_base.toml index 7f343ba1ac..0fcf8159cf 100644 --- a/crates/zed/assets/themes/_base.toml +++ b/crates/zed/assets/themes/_base.toml @@ -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