Skip to content

Extract shared help footer reflow#29

Merged
mariusvniekerk merged 3 commits into
mainfrom
codex/tui-helplayout-reflow
Jul 9, 2026
Merged

Extract shared help footer reflow#29
mariusvniekerk merged 3 commits into
mainfrom
codex/tui-helplayout-reflow

Conversation

@mariusvniekerk

Copy link
Copy Markdown
Contributor

Why

Roborev and kata currently maintain copies of the same help/footer packing algorithm. Keeping those copies separate invites ordering and width-boundary behavior to drift, but sharing either app implementation directly would couple kit to incompatible Charm major versions.

Design consequence

go.kenn.io/kit/tui/helplayout owns only unstyled help-item data and deterministic row layout. Callers explicitly provide the visible inter-column gap and retain ownership of styling and final rendering, so follow-on consumer migrations do not force Bubble Tea or lipgloss version choices into this module. Overwide items remain intact rather than being truncated by a layout helper.

Validation

  • go build ./...
  • go tool gotestsum --format pkgname-and-test-fails -- ./... (597 passed, 2 expected skips)
  • go vet ./...
  • go mod tidy produced no changes

generated by a clanker

@roborev-ci

roborev-ci Bot commented Jul 9, 2026

Copy link
Copy Markdown

roborev: Combined Review (32477c0)

Synthesis unavailable. Showing individual review outputs.

Review 1 (done)

Review Findings

  • Severity: Low
  • Location: tui/helplayout/layout.go:44
  • Problem: Overwide items are included in columnWidths when evaluating every candidate column count. That means one item wider than availableWidth can force all other items in the reflow call down to one column, even though the API documents only that the overwide item itself should be returned intact on its own row.
  • Fix: Isolate overwide items before measuring candidate columns, or otherwise exclude single overwide rows from the fit calculation, and add a test with one overwide item plus multiple narrow items that can still fit together.

Summary

The change adds a reusable terminal help/footer row reflow package with cell-width-aware layout and tests.


Review 2 (done)

The diff adds a terminal help-layout helper and a Unicode width dependency. I did not identify a changed security boundary, secret-bearing path, privileged operation, or externally exploitable input path with a concrete abuse case.

No issues found.

@roborev-ci

roborev-ci Bot commented Jul 9, 2026

Copy link
Copy Markdown

roborev: Combined Review (943f165)

No issues found.


Reviewers: 2 done | Synthesis: codex | Total: 1m15s

@roborev-ci

roborev-ci Bot commented Jul 9, 2026

Copy link
Copy Markdown

roborev: Combined Review (f98f974)

No issues found.


Reviewers: 2 done | Synthesis: codex | Total: 1m9s

mariusvniekerk and others added 3 commits July 9, 2026 18:13
Roborev and kata currently maintain copies of the same footer packing algorithm. That duplication risks behavior drift, while directly sharing either implementation would couple callers to incompatible Charm major versions.

Provide the primitive under kit's tui namespace so both apps can share stable ordering and terminal-cell width decisions without surrendering styling or rendering ownership. Explicit column-gap accounting keeps each caller's presentation choices outside the API.

Generated with Codex
Co-authored-by: Marius van Niekerk <mariusvniekerk@users.noreply.github.com>
Callers need reflow fit decisions and renderer alignment to use identical terminal-cell measurements; otherwise a renderer can disagree with the helper at exact-width boundaries. Empty source rows also need stable treatment across known and unknown widths so intentional separators survive resize.

Expose canonical column widths, preserve blank rows, and make the global overwide, text, and gap contracts explicit while retaining consumer-owned styling.

Generated with Codex
Co-authored-by: Marius van Niekerk <mariusvniekerk@users.noreply.github.com>
Column maxima alone still force renderers to remeasure each cell before adding alignment fill, which can diverge from reflow decisions at Unicode exact-width boundaries.

Expose the same per-item terminal-cell measurement used by ReflowRows and ColumnWidths so callers can calculate padding without depending on their rendering stack's width rules.

Generated with Codex
Co-authored-by: Marius van Niekerk <mariusvniekerk@users.noreply.github.com>
@mariusvniekerk mariusvniekerk force-pushed the codex/tui-helplayout-reflow branch from f98f974 to af0143a Compare July 9, 2026 22:13
@roborev-ci

roborev-ci Bot commented Jul 9, 2026

Copy link
Copy Markdown

roborev: Combined Review (af0143a)

No issues found.


Reviewers: 2 done | Synthesis: codex | Total: 1m34s

@mariusvniekerk mariusvniekerk merged commit 8b786ab into main Jul 9, 2026
8 checks passed
@mariusvniekerk mariusvniekerk deleted the codex/tui-helplayout-reflow branch July 9, 2026 22:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant