Skip to content

marker: Add alignment for centered and trailing rows - #3151

Merged
madcodelife merged 1 commit into
mainfrom
marker-alignment
Sep 21, 2026
Merged

madcodelife merged 1 commit into
mainfrom
marker-alignment

Conversation

@madcodelife

@madcodelife madcodelife commented Sep 21, 2026

Copy link
Copy Markdown
Member

Marker was the only chat component that baked horizontal placement into its variant: Separator always centered its label, Plain and Border always started at the leading edge. Bubble and Message already expose alignment(...). Transcript system rows (a stopped answer, a failed request with a retry action, a delivery state under an outgoing message) need a centered or trailing marker without divider lines, and the only way to get one was a Styled refinement on every call site.

This adds Marker::alignment(MarkerAlignment):

  • Unset, nothing changes: Separator centers, other variants start.
  • An explicit alignment applies to any variant and also aligns wrapped text lines inside MarkerContent.
  • A Separator with an explicit alignment keeps only the line on the far side of its label, so Start draws the trailing line and End the leading one.

The story gains an "Alignment" section; the Marker page is updated in both en and zh-CN.

Public API

  • pub enum MarkerAlignment { Start, Center, End } — horizontal placement of a Marker's children inside its full-width row.
  • Marker::alignment(self, alignment: MarkerAlignment) -> Self — sets that placement; unset keeps the variant default (Separator centers, others start).

Validation

  • cargo test -p gpui-component marker (builder test extended, new test_marker_resolved_alignment)
  • cargo clippy -p gpui-component -p gpui-component-story -- -D warnings
  • cargo fmt --all

`Marker` baked horizontal placement into its variant: `Separator` always
centered, `Plain` and `Border` always started. Add `Marker::alignment`
with `MarkerAlignment::{Start, Center, End}`, matching the `alignment`
builder on `Bubble` and `Message`. Unset keeps the variant default; an
explicit alignment also aligns wrapped text inside `MarkerContent`, and a
`Separator` then keeps only the line on the far side of its label.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018eA3Xrxo52YNodP8fBWEKk
@madcodelife
madcodelife merged commit d56539a into main Sep 21, 2026
12 checks passed
@madcodelife
madcodelife deleted the marker-alignment branch September 21, 2026 07:04
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