Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
gpui: Prevent underline and strikethrough artifacts on final glyph in text runs (#50934)
Pratik Karkia7e677efa502
diff --git a/crates/gpui/src/text_system/line.rs b/crates/gpui/src/text_system/line.rsindex 611c979bc29..9c6ffdbe3f6 100644--- a/crates/gpui/src/text_system/line.rs+++ b/crates/gpui/src/text_system/line.rs@@ -385,8 +385,12 @@ fn paint_line(glyph_origin.x - underline_origin.x,underline_style,);- underline_origin.x = origin.x;- underline_origin.y += line_height;+ if glyph.index < run_end {+ underline_origin.x = origin.x;+ underline_origin.y += line_height;+ } else {+ current_underline = None;+ }}if let Some((strikethrough_origin, strikethrough_style)) =current_strikethrough.as_mut()@@ -399,8 +403,12 @@ fn paint_line(glyph_origin.x - strikethrough_origin.x,strikethrough_style,);- strikethrough_origin.x = origin.x;- strikethrough_origin.y += line_height;+ if glyph.index < run_end {+ strikethrough_origin.x = origin.x;+ strikethrough_origin.y += line_height;+ } else {+ current_strikethrough = None;+ }}glyph_origin.x = aligned_origin_x(@@ -618,8 +626,12 @@ fn paint_line_background(},*background_color,));- background_origin.x = origin.x;- background_origin.y += line_height;+ if glyph.index < run_end {+ background_origin.x = origin.x;+ background_origin.y += line_height;+ } else {+ current_background = None;+ }}glyph_origin.x = aligned_origin_x(