Skip to content

Honor multiline filters in TextArea layout - #2143

Open
FanWu-ai wants to merge 1 commit into
prompt-toolkit:mainfrom
FanWu-ai:fix-textarea-multiline-filter-20261016
Open

FanWu-ai wants to merge 1 commit into
prompt-toolkit:mainfrom
FanWu-ai:fix-textarea-multiline-filter-20261016

Conversation

@FanWu-ai

Copy link
Copy Markdown

TextArea accepts FilterOrBool for multiline, but its constructor evaluates the filter's truth value. Passing Condition, Always, or Never raises ValueError before the widget can be used.

Resolve the height at layout time and use ConditionalMargin for line numbers and scrollbars. This allows the existing filter to change at runtime while retaining the single-line height and boolean behavior. Clarify the parameter's existing type in the docstring.

Eight new cases cover booleans, constant filters, callable conditions, changing heights/margins, and a running Application where Enter inserts a newline before a toggle and accepts the input afterward.

Validation on Linux / CPython 3.12.14:

  • Pristine complete suite: 156 passed; final complete suite: 164 passed.
  • Six added cases fail against the original implementation.
  • Ruff lint/format, typos, strict mypy for win32/linux/darwin, all 12 pinned hooks, wheel/sdist builds, and git diff --check pass.
  • Independent automated review reran all gates and checked 120 boolean rendering/dimension combinations against the original behavior, plus 21 repeated dynamic render transitions. Packaged source matches the tested implementation.

The mypy platform targets are static checks; other interpreter/native OS matrix combinations were not run locally.

Prepared and tested with OpenAI Codex assistance. No human review is claimed.

@FanWu-ai
FanWu-ai marked this pull request as ready for review October 15, 2026 21:34
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