Skip to content

fix(ui): fit the review panel and next-steps box to narrow terminals - #14

Merged
lnorton89 merged 2 commits into
mainfrom
claude/confident-edison-nqs7ek
Nov 17, 2026
Merged

lnorton89 merged 2 commits into
mainfrom
claude/confident-edison-nqs7ek

Conversation

@lnorton89

Copy link
Copy Markdown
Contributor

Below about 60 columns the interactive review panel's right edge wrapped onto the next line, and the next-steps box overflowed under about 75. I found this while comparing screens for #13; it happens on both clack versions.

Root cause

  • reviewLines() floored its wrap width at 40 columns however narrow the terminal was, then note() added 18 columns of label and frame around it.
  • The review title (name · kind · Rust 2024 · licence) was never fitted.
  • box() was sized only to its content (cargo clippy --all-targets -- -D warnings # the lint gate CI runs).
  • The existing test checked the review body against the width, but not the frame drawn around it.

Fix

src/ui/rail.ts exports the frame widths it draws (NOTE_FRAME, NOTE_TITLE_FRAME, BOX_FRAME), and callers fit to them:

  • The review body wraps to columns − frame − label. At 80+ columns this is the same number as before.
  • Title facts that don't fit move to the top of the panel instead of being cut. An over-long name is clipped with the glyph set's ellipsis.
  • The next box drops its # notes first, then its frame, so it never draws an edge that wraps.

Test plan

  • New test renders the whole framed output (note() and box()) at 30, 40, 44, 50, 58, 60, 80, 100 and 120 columns, in both glyph sets, for a GUI, a workspace with a long name plus --bin, and a library. It checks every line fits and no title fact is lost. It fails on the old code (a 58-column line at 30 columns).
  • npm run typecheck && npm test: 54/54
  • The real interactive session, driven in a pty through 18 screens, is identical to main at 80, 96 and 120 columns. At 44 columns the review now draws a complete 44-column frame.

Generated by Claude Code

Below about 60 columns the review's right edge wrapped onto the next
line. reviewLines() floored its wrap width at 40 columns no matter how
narrow the terminal, never fitted the title, and the next-steps box was
sized only to its content. The old test checked the review body
against the width but not the frame note() draws around it.

rail.ts now exports the frame widths it draws (NOTE_FRAME,
NOTE_TITLE_FRAME, BOX_FRAME), and callers fit to them:

- the review body wraps to columns - frame - label (unchanged at 80+
  columns: the interactive session is identical at 80, 96 and 120);
- title facts (kind, edition, licence) that don't fit move to the top
  of the panel instead of being cut, and an over-long name is clipped;
- the next box drops its # notes first, then its frame, rather than
  draw an edge that wraps.

The new test renders the whole framed output at 30-120 columns in both
glyph sets and fails on the old code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W2BaQmV2uiGiqUHSfS6KUH
Review follow-ups: box() takes an optional compact line list and owns
the whole fallback (full -> compact -> unboxed), so cli.ts no longer
repeats its fit test, and box() measures its content once. The review's
label column is derived from the sections again instead of a copied
list of their names.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W2BaQmV2uiGiqUHSfS6KUH

@lnorton89 lnorton89 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review

Five findings on 6a9b08a: three fixed in 3010ceb, two skipped on purpose.

Finding Outcome
The review's label width came from a hand-copied list of section names, so it could drift from sections Fixed: derived from sections again
cli.ts repeated box()'s fit rule to decide whether to drop the notes Fixed: box() takes an optional compact line list and owns the whole fallback (full → compact → unboxed)
box() measured its content twice Fixed
Still overflows below ~22–26 columns Skipped: the 12-column label plus frame can't fit there; the test covers 30 columns up
The --yes summary inherits the title split though it has no frame Skipped: cosmetic, and every fact is still shown

The new test also asserts the box keeps its frame exactly when the compact lines fit. CI: 32/32 green on 3010ceb. Locally: 54/54, and the interactive session is still identical to main at 80 and 120 columns.


Generated by Claude Code

@lnorton89
lnorton89 merged commit e6e61a4 into main Nov 17, 2026
32 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