Skip to content

Handle readline completion in one-row terminals - #2145

Open
FanWu-ai wants to merge 1 commit into
prompt-toolkit:mainfrom
FanWu-ai:fix/readline-one-row-terminal-20261018
Open

FanWu-ai wants to merge 1 commit into
prompt-toolkit:mainfrom
FanWu-ai:fix/readline-one-row-terminal-20261018

Conversation

@FanWu-ai

Copy link
Copy Markdown

Summary

Readline-style completion crashes with ZeroDivisionError when a terminal has one row: reserving the pager row leaves zero completions per page. Keep at least one content row so completion can still paginate.

The regression tests cover one-row, two-row, and normal-height terminals, checking that all completions are printed and confirmation/pager calls remain correct. The one-row case fails on the unchanged base; the other two already pass. A real POSIX PTY sized to 1×12 also reports this size through Vt100_Output.

Validation

  • Clean baseline: 156 tests passed; final full suite: 159 passed (Python 3.12.14, Linux).
  • Ruff check/format, typos, and all pre-commit hooks passed.
  • Strict mypy for win32, linux, and darwin passed.
  • Wheel and sdist builds, plus git diff --check, passed.

AI-assisted implementation and regression testing.

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