Skip to content

Keep the fork marker title from painting over popovers - #907

Open
jsgrrchg wants to merge 1 commit into
zeronsh:mainfrom
jsgrrchg:zeron/forked-from-component-bug
Open

jsgrrchg wants to merge 1 commit into
zeronsh:mainfrom
jsgrrchg:zeron/forked-from-component-bug

Conversation

@jsgrrchg

@jsgrrchg jsgrrchg commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

In side chats, opening the model picker above the composer showed the fork marker's source title (e.g. "Zeron") drawn on top of the picker card, over the effort slider and its thumb, crisp and unblurred.

Cause. The fork seam centered its title with text_center() on a full-width block. gpui paints each text line inside a paint_layer registered at the line origin with the text's own width (paint_line in text_system/line.rs), while the glyphs are shifted by aligned_origin_x. The draw-order bounds tree therefore sees the title as a small box at the left edge, so a popover layer painted later over the centered glyphs can get a draw order at or below them. Long titles that truncate fill the width and are unaffected; short ones trigger it.

Fix. Center the title with flex (justify_center) around a shrink-to-fit child, so its box matches the glyphs. min_w_0 + truncate keep long titles from widening narrow side-chat panes.

image

Possible follow-up. This only patches the fork marker; the root cause is in gpui's paint_line and still affects any text_center()/text_right() text in a block wider than its content (about 25 call sites in crates/ui/src) whenever a popover, menu or toast overlaps it. A fix could go in zui: register the line's layer over the aligned span (e.g. width align_width.max(layout.width), or starting from the aligned x) instead of origin + layout.width, then bump the rev. That touches the draw order of every aligned text line, so it would deserve its own change with a visual pass. Upstream gpui has the same code.

Validation:

  • cargo check -p zeron-ui passed.
  • rustfmt --check on the changed file passed.
  • Not yet verified visually in the running app.

The fork seam centered its source title with text_center() on a full-width
block. gpui registers a text line's paint layer at the line origin with the
text's own width, so alignment-shifted glyphs paint outside that layer and
can take a draw order at or above a popover opened later over them. In side
chats the model picker opened above the composer showed a short source
title drawn on top of its effort slider.

Center the title with flex instead, so its shrink-to-fit box matches the
glyphs. Long titles still truncate.
kopeng-mi added a commit to kopeng-mi/zeron that referenced this pull request Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant