Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

gpui: Fix text underline width (#26827)

Jason Leeb81a1ad91d3e
diff --git a/crates/gpui/src/text_system/line.rs b/crates/gpui/src/text_system/line.rs
index d638465ce72..859485aabee 100644
--- a/crates/gpui/src/text_system/line.rs
+++ b/crates/gpui/src/text_system/line.rs
@@ -196,11 +196,15 @@ fn paint_line(
);
let mut prev_glyph_position = Point::default();
let mut max_glyph_size = size(px(0.), px(0.));
+ let mut first_glyph_x = origin.x;
for (run_ix, run) in layout.runs.iter().enumerate() {
max_glyph_size = text_system.bounding_box(run.font_id, layout.font_size).size;
for (glyph_ix, glyph) in run.glyphs.iter().enumerate() {
glyph_origin.x += glyph.position.x - prev_glyph_position.x;
+ if glyph_ix == 0 {
+ first_glyph_x = glyph_origin.x;
+ }
if wraps.peek() == Some(&&WrapBoundary { run_ix, glyph_ix }) {
wraps.next();
@@ -355,7 +359,7 @@ fn paint_line(
}
}
- let mut last_line_end_x = glyph_origin.x;
+ let mut last_line_end_x = first_glyph_x + layout.width;
if let Some(boundary) = wrap_boundaries.last() {
let run = &layout.runs[boundary.run_ix];
let glyph = &run.glyphs[boundary.glyph_ix];