Skip to content

Hardcoded 120-column max width ignores large terminals #595

Closed

Description

@zhaider3c

Summary

useTerminalWidth caps content width to 120 columns regardless of terminal size, leaving most of a wide terminal empty.

Location

source/hooks/useTerminalWidth.ts (compiled to dist/hooks/useTerminalWidth.js):

const calculateBoxWidth = (columns) => Math.max(Math.min(columns - 4, 120), 40);

Also source/constants.ts sets DEFAULT_TERMINAL_WIDTH = 120 — unclear whether this was intended as a cap or just a fallback.

Impact

On a 190-column terminal, usable width is clamped to ~116 (120 − 4 padding), wasting ~74 columns of horizontal space. Forces users to either:

  • Resize their terminal smaller, or
  • Patch the dist file after every npm update

Suggested fix

  • Use the full terminal width as the max (or make it configurable)
  • At minimum remove the Math.min(columns - 4, 120) cap so it respects actual terminal width
  • Or expose a setting in nanocoder-preferences.json / agents.config.json for max-width

Workaround

sed -i "s/min(columns - 4, 120)/min(columns - 4, 999)/" \
  "$NVM_DIR/versions/node/$(ls -1 "$NVM_DIR/versions/node" | tail -1)/lib/node_modules/@nanocollective/nanocoder/dist/hooks/useTerminalWidth.js"

Activity

  1. RealBhupesh commented on Aug 3, 2026

    @RealBhupesh
    Contributor

    Hi @will-lamerton, I’d like to pick this issue up.

    I saw that #596 was closed after the feedback that a 1024-column cap was too permissive and that the related unit test still needed updating. I’ll submit a focused replacement PR that raises the cap to 200 columns, which covers the reported 190-column case while preserving a bounded layout, keeps the existing 40-column minimum, and updates the regression coverage.

    If you would prefer 160 columns or a preference-backed value, please let me know before review. I’ll keep the implementation limited to the terminal-width behavior described here.

  2. RealBhupesh commented on Aug 3, 2026

    @RealBhupesh
    Contributor

    Implemented in PR #742.

    The focused change raises the bounded terminal content width from 120 to 200 columns, keeps the existing 40-column minimum, reuses the shared constant in the responsive hook, and updates the regression coverage.

    Validation completed:

    • pnpm exec ava source/hooks/useTerminalWidth.spec.tsx - 10 tests passed
    • pnpm exec biome check source/constants.ts source/hooks/useTerminalWidth.tsx source/hooks/useTerminalWidth.spec.tsx
    • pnpm run test:types

    The PR is ready for review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions