Skip to content

TUI: re-read the window size so rows never overflow a smaller window - #29

Merged
Darknode-Official merged 1 commit into
mainfrom
fix/tui-missed-resize
Nov 11, 2026
Merged

Darknode-Official merged 1 commit into
mainfrom
fix/tui-missed-resize

Conversation

@Darknode-Official

Copy link
Copy Markdown
Owner

When the window shrinks and Nexus misses the resize signal, it keeps drawing every row for the old width. The terminal then wraps those rows: reply text spills onto the next line, the status bar takes two rows, and scroll-rail marks land mid-screen.

Fix: the TUI re-reads the window size every 500 ms. Node's refresh emits resize only when the size really changed, which runs the existing full repaint. The poll is unref'd and cleared on exit.

Verified

  • Real pty, with the signal handler removed: columns stayed at 120 after the window went to 78. The refresh read 78 and fired resize.
  • HOME=/tmp/nxhome-full npm test: all suites pass, including a new regression test.

Every row is clipped to the width Nexus believes the window has, which it
only learned from SIGWINCH. When that signal is missed, the width stays
stale: after shrinking a window, reply lines, the ask card and the status
bar were still drawn for the old width and the terminal wrapped them
(text spilling onto the next row, stray scroll-rail marks mid-screen).

The TUI now re-reads the size every 500 ms with the stream's own refresh,
which emits "resize" only when the size really changed, so the existing
full repaint runs. The poll is unref'd and stopped on exit.

Checked under a real pty: with the signal handler gone, columns stayed
at 120 after the window went to 78; the refresh read 78 and fired resize.
@Darknode-Official
Darknode-Official merged commit e14ce41 into main Nov 11, 2026
6 checks passed
@Darknode-Official
Darknode-Official deleted the fix/tui-missed-resize branch November 11, 2026 18:26
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