Skip to content

Implement CrossAxisAlignment options for TUI flex#13417

Merged
harryalbert merged 2 commits into
masterfrom
harry/tui-flex-alignment
Jul 7, 2026
Merged

Implement CrossAxisAlignment options for TUI flex#13417
harryalbert merged 2 commits into
masterfrom
harry/tui-flex-alignment

Conversation

@harryalbert

@harryalbert harryalbert commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Description

This PR was originally motivated by wanting to turn the input into a flex row w/ [!][input] (when shell mode was enabled). To do this with the existing flex API (where the flex reports its cross axis as the largest cross axis offered instead of auto-constraining the height), we would have had to manually constrain the row with a calculated height, which we could only know at layout time.

The solution was to update the TUI flex api to be aligned w/ the GUI flex API, where the flex now reports its cross axis as the largest child's cross extent, clamped to that constraint. You can still achieve the original full-constraint-reporting by using the CrossAxisAlignment::Stretch (using the same enum as the GUI w/ the same semantics), but you can also use the other cross axis alignment options offered to the GUI flex (i.e. start — the default — center, or end). With this change, the TUI flex's cross axis behavior reaches feature/behavior parity w/ the GUI flex.

The PR above this one uses this new API to implement the [!][input] flex row for the input.

Testing

  • I have manually tested my changes locally with ./script/run

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent Mode

@cla-bot cla-bot Bot added the cla-signed label Jul 6, 2026

harryalbert commented Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

@harryalbert harryalbert changed the title tui: content-sized flex cross axis + CrossAxisAlignment Implement CrossAxisAlignment options for TUI flex Jul 6, 2026
@harryalbert harryalbert marked this pull request as ready for review July 6, 2026 22:29
@harryalbert harryalbert requested a review from kevinyang372 July 6, 2026 22:29
@oz-for-oss

oz-for-oss Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

@harryalbert

I'm starting a first review of this pull request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@oz-for-oss oz-for-oss Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overview

This PR changes TuiFlex cross-axis sizing/alignment semantics, adds CrossAxisAlignment support, updates affected TUI call sites, and adds coverage for the new layout behavior.

Concerns

  • For this user-facing TUI layout change, the PR description lists manual testing but does not include screenshots or a screen recording. Repository review guidance requires visual evidence demonstrating user-visible behavior end to end.

Verdict

Found: 0 critical, 1 important, 0 suggestions

Request changes

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Comment thread crates/warp_tui/src/agent_block_sections.rs
harryalbert and others added 2 commits July 7, 2026 14:45
TuiFlex now sizes its cross axis to its largest child (clamped to the
constraint) instead of filling the offered extent, matching the GUI
Flex/Flutter policy. with_cross_axis_alignment() mirrors the GUI enum:
Start (default), Center/End position each child within its slot, and
Stretch fills the offered cross extent and tightens child constraints
(used by the transcript input banner). The input editor element now
claims its full wrap width since its inner column hugs content.

Co-Authored-By: Oz <oz-agent@warp.dev>
Co-Authored-By: Oz <oz-agent@warp.dev>
@harryalbert harryalbert force-pushed the harry/tui-flex-alignment branch from 23000b8 to a16368f Compare July 7, 2026 18:47
@harryalbert harryalbert mentioned this pull request Jul 7, 2026
2 tasks
@harryalbert harryalbert merged commit 43cf43c into master Jul 7, 2026
27 checks passed
@harryalbert harryalbert deleted the harry/tui-flex-alignment branch July 7, 2026 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants