From cf68ad3a82a19cd0d66c0c37b2e91ae1ca5392de Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Tue, 7 Sep 2021 11:03:43 +0200 Subject: [PATCH] Trim pending underline when text runs don't cover the whole line --- gpui/src/text_layout.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/gpui/src/text_layout.rs b/gpui/src/text_layout.rs index 692efaf424..a553b3b478 100644 --- a/gpui/src/text_layout.rs +++ b/gpui/src/text_layout.rs @@ -293,6 +293,17 @@ impl Line { } else { run_end = self.layout.len; color = Color::black(); + if let Some(underline_origin) = underline_start.take() { + cx.scene.push_underline(scene::Quad { + bounds: RectF::from_points( + underline_origin, + glyph_origin + vec2f(0., 1.), + ), + background: Some(color), + border: Default::default(), + corner_radius: 0., + }); + } } }