marker: Add alignment for centered and trailing rows - #3151
Merged
Merged
Conversation
`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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Markerwas the only chat component that baked horizontal placement into its variant:Separatoralways centered its label,PlainandBorderalways started at the leading edge.BubbleandMessagealready exposealignment(...). 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 aStyledrefinement on every call site.This adds
Marker::alignment(MarkerAlignment):Separatorcenters, other variants start.MarkerContent.Separatorwith an explicit alignment keeps only the line on the far side of its label, soStartdraws the trailing line andEndthe leading one.The story gains an "Alignment" section; the
Markerpage is updated in bothenandzh-CN.Public API
pub enum MarkerAlignment { Start, Center, End }— horizontal placement of aMarker's children inside its full-width row.Marker::alignment(self, alignment: MarkerAlignment) -> Self— sets that placement; unset keeps the variant default (Separatorcenters, others start).Validation
cargo test -p gpui-component marker(builder test extended, newtest_marker_resolved_alignment)cargo clippy -p gpui-component -p gpui-component-story -- -D warningscargo fmt --all