Skip to content

Preserve maximum sizes of zero-preferred dimensions - #2136

Open
FanWu-ai wants to merge 1 commit into
prompt-toolkit:mainfrom
FanWu-ai:fix-zero-preferred-dimension-caps-20261012
Open

FanWu-ai wants to merge 1 commit into
prompt-toolkit:mainfrom
FanWu-ai:fix-zero-preferred-dimension-caps-20261012

Conversation

@FanWu-ai

Copy link
Copy Markdown

max_layout_dimensions treats every zero-preferred dimension as empty, discarding its finite maximum. Wrapping Window(width=Dimension(max=10, preferred=0)) in an HSplit therefore removes its 10-column cap: an adjacent VSplit assigns it 40 columns out of 80 instead of 10.

Ignore only dimensions whose maximum is zero. Preserve explicit finite caps while retaining the existing rule that other children's larger preferred sizes take precedence. Invisible children still cannot shrink visible siblings.

Add eleven tests covering a lone cap, default/invisible siblings, multiple caps, positive preferred siblings, empty inputs and a real nested split. Eight regressions fail on unchanged source.

Validation on Linux / Python 3.12.14:

  • Fresh pristine complete suite: 156 passed; final complete suite: 167 passed, no skips.
  • Ruff lint/format, typos, and strict Mypy checks for Linux, Windows and macOS pass. Those are platform-aware static checks, not native OS test runs.
  • All twelve configured pinned hooks, wheel/sdist builds, strict Twine checks and git diff --check pass.
  • Independent automated review reran the full suite and required static checks, reproduced the old failures, and passed 7,395 additional assertions including both real layout axes.

Other interpreter/native OS and hosted CI results are not claimed. Prepared and tested with OpenAI Codex assistance; no human review is claimed.

Do not discard a finite maximum merely because a child prefers zero.
Keep hidden zero-size dimensions ignored and add real layout regressions.

AI assistance: OpenAI Codex.
@FanWu-ai
FanWu-ai marked this pull request as ready for review October 11, 2026 21:39
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