Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
gpui: Fix background for WrappedLine (#27980)
Smit Barmase501b539286db
diff --git a/crates/gpui/src/elements/text.rs b/crates/gpui/src/elements/text.rsindex cd6cf033dbd..2407606a663 100644--- a/crates/gpui/src/elements/text.rs+++ b/crates/gpui/src/elements/text.rs@@ -417,6 +417,15 @@ impl TextLayout {let mut line_origin = bounds.origin;let text_style = window.text_style();for line in &element_state.lines {+ line.paint_background(+ line_origin,+ line_height,+ text_style.text_align,+ Some(bounds),+ window,+ cx,+ )+ .log_err();line.paint(line_origin,line_height,diff --git a/crates/gpui/src/text_system/line.rs b/crates/gpui/src/text_system/line.rsindex 1ebec668c70..ee351c342a0 100644--- a/crates/gpui/src/text_system/line.rs+++ b/crates/gpui/src/text_system/line.rs@@ -153,6 +153,36 @@ impl WrappedLine {Ok(())}++ /// Paint the background of line of text to the window.+ pub fn paint_background(+ &self,+ origin: Point<Pixels>,+ line_height: Pixels,+ align: TextAlign,+ bounds: Option<Bounds<Pixels>>,+ window: &mut Window,+ cx: &mut App,+ ) -> Result<()> {+ let align_width = match bounds {+ Some(bounds) => Some(bounds.size.width),+ None => self.layout.wrap_width,+ };++ paint_line_background(+ origin,+ &self.layout.unwrapped_layout,+ line_height,+ align,+ align_width,+ &self.decoration_runs,+ &self.wrap_boundaries,+ window,+ cx,+ )?;++ Ok(())+ }}fn paint_line(