Skip to content

Wrap text inside a border or a horizontal stack to the width it gets [patch] - #205

Merged
matt-edmondson merged 1 commit into
mainfrom
claude/tui-161-wrap-in-border-and-horizontal-stack
Oct 9, 2026
Merged

matt-edmondson merged 1 commit into
mainfrom
claude/tui-161-wrap-in-border-and-horizontal-stack

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Fixes #161

What changed

  • BorderElement overrides the width-aware OnCalculateRequiredDimensionsForChildren(int) and forwards the width inside the border to its child. The title-width rule from BorderElement title is truncated or not drawn at all because the border's measured width ignores the title #157 is shared between both overloads.
  • Horizontal StackPanel measures each child against the width still free: contentArea.Width - currentOffset when arranging, and the available width minus earlier siblings and spacing when measuring. Width-independent measures (no width given) are unchanged.

Tests

  • Replaced ContainerWithoutAWidthAwareLayoutMeasuresTheSameWithAWidth, which locked in the old behaviour, with five tests:
    • a border measures wrapped text against its inner width
    • wrapped text in a border in a vertical stack draws every line (the issue's scenario 1)
    • a horizontal stack reports the wrapped height
    • a horizontal stack measures each child against the remaining width
    • wrapped text in a horizontal stack in a vertical stack draws every line and pushes the next row down (scenario 2, as seen by a parent)
  • All five fail with the source change reverted and pass with it. The full TUI.Test suite passes (260/260).

🤖 Generated with Claude Code

https://claude.ai/code/session_016rdMXULeUT13t6FCwNfocx


Generated by Claude Code

…[patch]

BorderElement measured its child without the width its parent passed in,
and a horizontal StackPanel measured children width-independently, so
word-wrapped text in either reported one unwrapped row and only its first
line was drawn. BorderElement now forwards the width inside the border,
and a horizontal StackPanel measures each child against the width its
earlier siblings and the spacing leave, in both arrange and measure.

Replaces the test that locked in the border's width-blind measure.

Fixes #161

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016rdMXULeUT13t6FCwNfocx
@sonarqubecloud

sonarqubecloud Bot commented Oct 8, 2026

Copy link
Copy Markdown

@matt-edmondson
matt-edmondson merged commit 7390b29 into main Oct 9, 2026
14 checks passed
@matt-edmondson
matt-edmondson deleted the claude/tui-161-wrap-in-border-and-horizontal-stack branch October 9, 2026 08:00
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.

Word-wrapped text inside a BorderElement or a horizontal StackPanel still shows only its first line

2 participants