nanocoder icon indicating copy to clipboard operation
nanocoder copied to clipboard

[Bug] The welcome menu's columns wrap apart on narrow terminals, independent of #1330's height fix

Open addyCooks opened this issue 2 months ago • 1 comments

Description

The welcome screen's onboarding menu (Resume session /resume, etc.) lays out each row as one line of text with computed inline padding, sized against the labels' own text width never checked against the actual terminal width. Below a certain column count, a row's label + gap + key no longer fits and wraps onto separate, inconsistently-indented lines.

Distinct from #1330 (closed, fixed by #1376): that issue was a height-budget bug at standard 80×24 — the last menu item and tip line were missing entirely because the row-count threshold didn't account for the footer. This issue is a width-budget bug, reproduces at a generous height (32 rows, nothing vertically clipped), and every item is still present just wrapped and misaligned rather than missing. Verified live against current main, after #1376's merge: this reproduces identically, confirming the two are separate defects in separate code paths (row-budget thresholds vs. the row's own inline width math), not the same bug resurfacing.

Parent: #907

Steps to Reproduce

  1. Start (or resize) Nanocoder at a very narrow terminal width (e.g. 20 columns), with normal height (24+ rows).
  2. Look at the welcome screen's menu section.

Expected Behavior

The menu falls back to a narrower layout (or is omitted) rather than visually breaking apart the way MENU_MIN already exists as a narrower fallback for the height budget.

Actual Behavior

At 20 columns, each menu row's label and its slash-command key land on separate lines at inconsistent indents:

Resume session
/resume
Select model
/model
Help
/help
Quit
/exit

The composer's own border also visibly breaks apart at this width in the same capture.

Recording

Image

Root Cause

source/components/welcome-message.tsx:109 computes colW purely from menu.map(([l,k]) => l.length + k.length) a function of the label/key text, never of actualWidth/termW. Each row renders as a single <Text> combining label + computed gap + key inside a <Box justifyContent={justify} width={termW}>, with no explicit width guard, so on a narrow terminal the row's natural width exceeds termW and wraps.

Suggested Fix

Guard the menu render against actualWidth: fall back to the already-existing MENU_MIN (or drop the key column entirely) once actualWidth is below the menu's own computed colW, the same way the row-budget (MENU_MIN_ROWS/MENU_FULL_ROWS) already gates on height.

Additional Context

  • [x] I have searched existing issues to ensure this is not a duplicate (checked specifically against #1330/#1376, see Description)
  • [x] I can reproduce this issue consistently
  • [x] This issue occurs on the latest main

addyCooks avatar Sep 22 '26 08:09 addyCooks

Hey @akramcodez ! I’ve been looking into this , could you assign it to me?

addyCooks avatar Sep 22 '26 08:09 addyCooks