Skip to content

refactor(tui): share one content column and grid the VM row - #27

Merged
NovusEdge merged 4 commits into
mainfrom
tui-layout-restructure
Aug 9, 2026
Merged

refactor(tui): share one content column and grid the VM row#27
NovusEdge merged 4 commits into
mainfrom
tui-layout-restructure

Conversation

@NovusEdge

Copy link
Copy Markdown
Owner

The layout half of the TUI review (spec: 2026-08-09-tui-layout-fixes). Fixes the "goofy" composition: fragments of different widths each centered on their own, and both axes re-centering as content appeared.

Shared column. appContentWidth = 72 and a column(width, parts...) helper that stacks parts left-aligned inside one block. Every screen's JoinVertical(lipgloss.Center, …) becomes column(appContentWidth, …). The detail screen's facts box, last-provision pane, and progress panel all render via paneAt(…, appContentWidth, …), so the three boxes share one left edge and screen switches stop shifting the block sideways.

One deviation from the spec: column widens to the widest part instead of shrinking to width. A lipgloss Width() narrower than its content word-wraps it, which mangles a bordered pane's box-drawing. The list pane plus its side-by-side access box is routinely wider than 72. TestToastOverlayKeepsScreenShape fails with the literal spec and passes with widen-only.

Top anchor. View() anchors to lipgloss.Top with a one-line top margin instead of the old height-triggered center/top switch, so only content below a change moves. The search and status lines are always-present slots (blank when empty), so an appearing prompt replaces blank space instead of pushing every line down. listRowsHeadroom grew 14 → 16 for the two reserved lines.

VM row grid. Fixed lipgloss cells replace fmt.Sprintf("%-14s %-5s %5dM %2dc"): name (ansi.Truncate), mode, right-aligned RAM/CPU, and the uptime + port in their own cells so the port lands in the same column on every running row. The broken-row wrap uses a width cell joined with JoinHorizontal instead of a manual hanging indent.

Also: the detail progress panel collapses the bar and number onto one row, and provLine is ansi.Truncate'd to appContentWidth as a backstop.

Tests: TestColumnHoldsEveryLineWithinWidth, TestListRowWidthInvariantForLongNames (a 242-cell row under the old code, bounded now). just check and just test pass.

Worth an eyeball in a real terminal before merge — the width invariants are covered by tests, but the visual result is best judged live.

Every screen used to center its own JoinVertical(Center, ...) block
independently. A pane changing width on screen switch, or a status
line appearing, shifted the whole block sideways or downward.

column() stacks a screen's parts left-aligned at appContentWidth (or
wider, when a part like the list-plus-access box needs more). The
list, detail, form, and edit screens now all render through it, so
they share one left edge.

The list's search line and every screen's status line are now
always-present slots, blank when empty, instead of conditionally
appended lines. An appearing prompt replaces blank space instead of
pushing the footer down.

App.go anchors the frame to the top with a one-line margin instead of
centering vertically, so a height change moves only the content below
it, not the whole screen.
fmt.Sprintf("%-14s %-5s %5dM %2dc  ", ...) padded but never truncated.
A VM name longer than 14 cells pushed mode, ram, cpu, and the running
suffix out of column, breaking the row's width budget.

Each cell is now its own fixed-width lipgloss style. The name cell
truncates with ansi.Truncate instead of overflowing. The running
suffix (uptime, port) gets its own two cells, so the port lands in
the same column on every running row regardless of uptime length.

The broken-row wrap used a hand-built hanging indent from
strings.Repeat. It now wraps the reason text to its own column and
joins it beside the glyph with lipgloss.JoinHorizontal, which lines
up the continuation under the text without the indent arithmetic.
renderProgressPanel drew the bar and its percent or count on two
separate, label-less rows. They describe one value; progressLabel
already renders them on one line for the compact list form. The
detail panel now matches it. The panel also renders through paneAt at
appContentWidth, so it shares the detail screen's column instead of
hugging its own content width.

provLine had no total width cap. A long VM name could push the row
past the pane and wrap it. Every field on the line already caps its
own piece; this truncates the sum as a backstop.
TestColumnHoldsEveryLineWithinWidth pins that column() pads every
line to a shared width rather than letting shorter parts drift.

TestListRowWidthInvariantForLongNames pins the fixed-cell row grid: a
200-char VM name must not push a running row past listWidth. It fails
against the old fmt.Sprintf row (242 cells) and passes against the
new one.

TestDetailSurfacesVNCForAHeadlessVM and
TestDetailExplainsTheVNCFallbackOnAHeadlessHost asserted an unbroken
socket path in the rendered output. The facts pane now holds every
value to appContentWidth, so a path longer than that column wraps
mid-token across two lines instead of widening the pane. Both now
check for the path with the pane's border and whitespace stripped, so
a wrapped path still matches.
@NovusEdge NovusEdge added the enhancement New feature label Aug 9, 2026
@NovusEdge NovusEdge self-assigned this Aug 9, 2026
@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@NovusEdge, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 2 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 501c3db1-a6b6-4382-b8c6-fd20e4088055

📥 Commits

Reviewing files that changed from the base of the PR and between eb8889b and 779f205.

📒 Files selected for processing (11)
  • internal/tui/app.go
  • internal/tui/detail.go
  • internal/tui/detail_test.go
  • internal/tui/edit.go
  • internal/tui/form.go
  • internal/tui/geometry_test.go
  • internal/tui/list.go
  • internal/tui/progressbar.go
  • internal/tui/provstep.go
  • internal/tui/theme.go
  • internal/tui/vmlist.go

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@NovusEdge
NovusEdge merged commit 7fd4128 into main Aug 9, 2026
8 checks passed
@NovusEdge
NovusEdge deleted the tui-layout-restructure branch August 9, 2026 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant