Skip to content

Make TUI views fit terminal width dynamically#18

Merged
wesm merged 7 commits intoroborev-dev:mainfrom
andyxhadji:tui-dynamic-column-widths
Jan 9, 2026
Merged

Make TUI views fit terminal width dynamically#18
wesm merged 7 commits intoroborev-dev:mainfrom
andyxhadji:tui-dynamic-column-widths

Conversation

@andyxhadji
Copy link
Contributor

Replaces fixed column widths with dynamic sizing based on terminal width.

Changes:

  • Added columnWidths struct to track dynamic widths for ref, repo, agent
  • Added calculateColumnWidths() to distribute available space proportionally
  • Updated renderJobLine() to accept and use dynamic column widths
  • Increased separator line max width to 200 chars

This allows the TUI to properly utilize wide terminals while maintaining readability on narrow terminals.

@andyxhadji andyxhadji force-pushed the tui-dynamic-column-widths branch from 3a9b76c to 6b775b4 Compare January 9, 2026 16:08
@wesm
Copy link
Collaborator

wesm commented Jan 9, 2026

Nice. I'll rebase this and merge it, stand by

andyxhadji and others added 2 commits January 9, 2026 11:55
Replaces fixed column widths with dynamic sizing based on terminal width.

Changes:
- Added columnWidths struct to track dynamic widths for ref, repo, agent
- Added calculateColumnWidths() to distribute available space proportionally
- Updated renderJobLine() to accept and use dynamic column widths
- Increased separator line max width to 200 chars

Column distribution: Ref (40%), Repo (35%), Agent (25%) of available space
Fixed columns (Status, Queued, Elapsed, Addr'd) maintain constant widths

This allows the TUI to properly utilize wide terminals while maintaining
readability on narrow terminals.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Tests calculateColumnWidths() at various terminal widths and
renderJobLine() truncation behavior with long/short values.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@wesm wesm force-pushed the tui-dynamic-column-widths branch from 6b775b4 to 11f488a Compare January 9, 2026 17:58
wesm and others added 5 commits January 9, 2026 12:01
- Fix wrapWidth to clamp to terminal width instead of using max(80, ...)
- Fix Addr'd column width calculation (6 chars, not 5)
- Scale column widths proportionally on narrow terminals to prevent overflow
- Update tests to verify total width doesn't exceed terminal width

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Use git range instead of SHA to test ref truncation (shortRef reduces
  SHA to 7 chars, bypassing the truncation logic)
- Add TestTUIRenderJobLineLength to verify total line length respects
  column widths

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove artificial floor on availableWidth that caused overflow
- Scale columns proportionally to fit available space
- Fix wrapWidth to clamp to terminal width (was using max instead of min)
- Update tests to document expected behavior: >= 80 cols should fit,
  narrower terminals may overflow (user should widen terminal)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@wesm wesm merged commit a7c182d into roborev-dev:main Jan 9, 2026
2 checks passed
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.

2 participants