Skip to content

TUI: wrap long prose in the mod details view instead of truncating at panel width #232

Description

@dyoung522

Found by the final whole-branch review of #86. Not a regression — it matches the behavior the infoOverlay changelog viewer already ships — but it undercuts #86's "full lmm mod show parity" claim, so it's worth closing separately.

Problem

modDetailsContent.body() (internal/tui/moddetails.go) splits the description on \n only. The host then applies truncateLines, which cuts each resulting line at panel width and appends .

So a mod whose description is one 400-character paragraph — the common shape on NexusMods — renders as roughly 78 visible characters, with the remainder unreachable: no wrap, no horizontal scroll, and vertical scrolling doesn't help because the text is one logical line.

The CLI doesn't have this problem: doModShow calls fmt.Println(desc) and lets the terminal soft-wrap the full text. So the two interfaces genuinely diverge on long prose, which is the one thing #86 set out to make identical.

Precedent and scope

internal/tui/overlay.go:165,173 (the changelog viewer, v1.14.0) truncates the same way, so this is a pre-existing convention rather than something #86 introduced. Fixing it well probably means fixing both surfaces — a changelog has exactly the same shape as a description.

Fix shape

ansi.Wordwrap is already an indirect dependency via lipgloss, so no new module is needed. Word-wrap prose blocks (Summary, Description) to the content width in body() before the host truncates, so the wrapped lines become real slice elements and the existing scroll machinery carries them.

Two things to get right:

  • The wrap must happen against the content width the host passes to Lines, not a guess, or it will disagree with truncateLines and still clip.
  • Lines' len(result) <= height invariant must survive — wrapping increases the line count, so maxOffset and the ↓ N more count both need to be computed against the wrapped body, not the raw one. TUI: mod details view (parity with lmm mod show) #86 already had one defect in exactly this arithmetic (a scroll indicator that overflowed its budget), so it deserves a test pinning the invariant across wrapped content.

Non-prose lines (ID:, URL:, Image:) should keep truncating — a wrapped URL is worse than a clipped one.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:tuiinternal/tui - screens, keys, renderingenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions