diff --git a/crates/gpui/src/text_system/line.rs b/crates/gpui/src/text_system/line.rs index 611c979bc2..9c6ffdbe3f 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(