Skip to content

fix(core): treat 0 tty cols/rows as invalid#687

Open
remorses wants to merge 6 commits intoanomalyco:mainfrom
remorses:fix-bun-compiled-tty-dimensions
Open

fix(core): treat 0 tty cols/rows as invalid#687
remorses wants to merge 6 commits intoanomalyco:mainfrom
remorses:fix-bun-compiled-tty-dimensions

Conversation

@remorses
Copy link
Copy Markdown
Contributor

@remorses remorses commented Feb 14, 2026

TTY streams can report terminal columns/rows as 0 even while isTTY is true.

CliRenderer currently uses nullish fallback (??) when assigning terminal dimensions, which preserves the invalid 0 values and can cascade into invalid buffer dimensions.

This change treats non-positive values as invalid and falls back to the renderer’s initial dimensions. No behavior change when columns/rows are already sane (> 0).

Copilot AI review requested due to automatic review settings February 14, 2026 12:40
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Feb 14, 2026

@opentui/core

npm i https://pkg.pr.new/@opentui/core@3fe9871

@opentui/react

npm i https://pkg.pr.new/@opentui/react@3fe9871

@opentui/solid

npm i https://pkg.pr.new/@opentui/solid@3fe9871

@opentui/core-darwin-arm64

npm i https://pkg.pr.new/@opentui/core-darwin-arm64@3fe9871

@opentui/core-darwin-x64

npm i https://pkg.pr.new/@opentui/core-darwin-x64@3fe9871

@opentui/core-linux-arm64

npm i https://pkg.pr.new/@opentui/core-linux-arm64@3fe9871

@opentui/core-linux-x64

npm i https://pkg.pr.new/@opentui/core-linux-x64@3fe9871

@opentui/core-win32-arm64

npm i https://pkg.pr.new/@opentui/core-win32-arm64@3fe9871

@opentui/core-win32-x64

npm i https://pkg.pr.new/@opentui/core-win32-x64@3fe9871

commit: 3fe9871

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adjusts CliRenderer terminal dimension initialization to avoid propagating invalid 0 values for TTY size (notably observed in Bun-compiled binaries), preventing downstream invalid buffer sizing.

Changes:

  • Treat non-positive stdout.columns / stdout.rows as invalid during CliRenderer construction.
  • Fall back to the renderer’s initial width/height when terminal dimensions are missing or invalid.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Fall back to current terminal dimensions instead of hardcoded 80x24
when SIGWINCH fires with invalid values.
simonklee
simonklee previously approved these changes Feb 14, 2026
@remorses

This comment was marked as off-topic.

@remorses remorses requested a review from simonklee March 10, 2026 08:20
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.

3 participants