[PR #687] fix(core): treat 0 tty cols/rows as invalid #1496

Open
opened 2026-03-14 09:39:48 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/anomalyco/opentui/pull/687
Author: @remorses
Created: 2/14/2026
Status: 🔄 Open

Base: mainHead: fix-bun-compiled-tty-dimensions


📝 Commits (6)

  • a85f626 fix(core): treat 0 tty cols/rows as invalid
  • da20fb7 fix(core): also guard SIGWINCH handler against 0 cols/rows
  • 3f776b3 style: fix prettier line length
  • 1d2e207 fix(core): add 80x24 ultimate fallback if width/height params are also 0
  • 3fb1faa Merge branch 'main' into fix-bun-compiled-tty-dimensions
  • c35529d Merge branch 'main' into fix-bun-compiled-tty-dimensions

📊 Changes

1 file changed (+10 additions, -4 deletions)

View changed files

📝 packages/core/src/renderer.ts (+10 -4)

📄 Description

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).


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/anomalyco/opentui/pull/687 **Author:** [@remorses](https://github.com/remorses) **Created:** 2/14/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix-bun-compiled-tty-dimensions` --- ### 📝 Commits (6) - [`a85f626`](https://github.com/anomalyco/opentui/commit/a85f626d1189acebe9635abcb1dcf2302123affc) fix(core): treat 0 tty cols/rows as invalid - [`da20fb7`](https://github.com/anomalyco/opentui/commit/da20fb72b450907c7efed40d047bc6869ce74a6a) fix(core): also guard SIGWINCH handler against 0 cols/rows - [`3f776b3`](https://github.com/anomalyco/opentui/commit/3f776b38afcc4db4a1611059dc8dba5abc40ade2) style: fix prettier line length - [`1d2e207`](https://github.com/anomalyco/opentui/commit/1d2e207fb0edc12cbadd76a5f8f78ff93a82d29b) fix(core): add 80x24 ultimate fallback if width/height params are also 0 - [`3fb1faa`](https://github.com/anomalyco/opentui/commit/3fb1faa4014f65674d67cd6447cef57893412d25) Merge branch 'main' into fix-bun-compiled-tty-dimensions - [`c35529d`](https://github.com/anomalyco/opentui/commit/c35529de6a5fd634136e094dec79c30072de3fce) Merge branch 'main' into fix-bun-compiled-tty-dimensions ### 📊 Changes **1 file changed** (+10 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `packages/core/src/renderer.ts` (+10 -4) </details> ### 📄 Description 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). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/opentui#1496
No description provided.