Skip to content

Feature: auto-scale progress bars based on terminal width #231

@sunsight210-bit

Description

@sunsight210-bit

Problem

When the terminal window is narrow, the status line content overflows and wraps, making it hard to read:

Context ░░░░░░░░░░ 4% │ Usage ███░░░░░░░ 27% (2h 49m / 5h) | ██░░░░░░░░ 16% (5d 5h / 7d)

The progress bars (coloredBar / quotaBar) are hardcoded to width: 10 in session-line.ts, lines/identity.ts, and lines/usage.ts. The render function already detects terminal width via getTerminalWidth() and wraps lines, but the bars themselves never shrink.

Proposed Solution

Dynamically scale the bar width based on process.stdout.columns. For example:

  • Wide terminal (≥100 cols): keep width: 10 (current default)
  • Medium terminal (60–99 cols): reduce to width: 6
  • Narrow terminal (<60 cols): reduce to width: 4 or hide bars entirely, showing only the percentage

This way the most important information (percentages, reset times) stays visible even in small windows.

Current Behavior

  • Bar width is always 10 characters regardless of terminal size
  • Narrow terminals cause line wrapping via wrapLineToWidth, breaking the layout

Expected Behavior

  • Bars scale down proportionally when terminal is narrow
  • Critical info (percentages, times) is always visible

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions