nanocoder icon indicating copy to clipboard operation
nanocoder copied to clipboard

[Bug] Resizing the terminal sometimes doesn't re-layout the UI at all

Open addyCooks opened this issue 2 months ago • 1 comments

Description

actualWidth is a raw, non-reactive read of process.stdout.columns. The only state that actually triggers a re-render is a separately-clamped boxWidth. A resize that doesn't move boxWidth produces zero re-renders every layout consumer (welcome screen, input box, status bar, session selector) can silently freeze at the old layout after a resize, sized for a terminal that no longer exists.

Parent: #907

Steps to Reproduce

  1. Start Nanocoder at a given terminal size.
  2. Resize the terminal to a different size.
  3. Observe the layout.

Expected Behavior

The UI re-measures and redraws for the new terminal size.

Actual Behavior

The UI can keep rendering content sized for the old width. Since the real terminal is now a different size, lines drawn for the old width get cut off mid-word by the terminal itself, and boxes end up visibly misaligned.

Recording

Image

Root Cause

source/hooks/useTerminalWidth.tsx:7-8,112 calculateBoxWidth = Math.max(Math.min(columns - 4, 200), 40) is the only reactive state; actualWidth = process.stdout.columns is a raw render-time read with no subscription of its own.

Suggested Fix

Subscribe directly to the raw column/row count instead of deriving reactivity from the already-clamped boxWidth.

Additional Context

  • [x] I have searched existing issues to ensure this is not a duplicate
  • [x] I can reproduce this issue consistently
  • [x] This issue occurs on the latest main

addyCooks avatar Sep 15 '26 18:09 addyCooks

Hi @akramcodez ! Happy to take this one could you assign it to me?

addyCooks avatar Sep 15 '26 18:09 addyCooks