Repository navigation
Conversation
The expanded view word-wraps every command line instead of truncating it, keeping syntax colors across rows. The first line hangs under the command's first column; later lines wrap behind the │ branch. Adds fakedata/exec_wrap.star for manual QA.
There was a problem hiding this comment.
Two wrapping defects exist in the heredoc/command rendering path at tool.go:655. The more critical one is that lipgloss.Wrap can return rows exceeding the target width at breakpoint boundaries, causing truncation to silently drop command characters (e.g., && operators or trailing characters). A separate issue is that lipgloss.Wrap strips leading source whitespace from heredoc rows, misrepresenting indentation in Python or Makefile content.
🤖 Bits Code Review · Commit a7f5768
| func hangWrap(lead, cont string, prefixWidth int, body string, width int) []string { | ||
| width = max(1, width) | ||
| bodyWidth := max(1, width-prefixWidth) | ||
| rows := strings.Split(lipgloss.Wrap(body, bodyWidth, shellBreakpoints), "\n") |
There was a problem hiding this comment.
Preserve source indentation when wrapping heredoc rows
At width 32, a heredoc row containing eight spaces followed by print('abcdefghij') becomes an empty branch row followed by the code without its source indentation. The row previously fit without truncation. This misrepresents significant Python or Makefile indentation in expanded commands. Preserving source whitespace requires adjusting the wrapping path rather than allowing lipgloss.Wrap to discard it.
React: 👍 useful · 👎 wrong · 😕 unclear · 👀 right, but not acting on it
What each reaction means
- 👍 Useful: correct, and you're fixing it or will.
- 👎 Wrong: the finding is incorrect, for example the bug can't happen or the code was misread.
- 😕 Unclear: you can't tell what it means or why it matters.
- 👀 Right, not acting: correct, but intended, out of scope for this PR, a known risk, or too minor.
🤖 Bits Code Review · Open Bits AI session
| func hangWrap(lead, cont string, prefixWidth int, body string, width int) []string { | ||
| width = max(1, width) | ||
| bodyWidth := max(1, width-prefixWidth) | ||
| rows := strings.Split(lipgloss.Wrap(body, bodyWidth, shellBreakpoints), "\n") |
There was a problem hiding this comment.
Hard-wrap oversized rows before truncation
At a rendering width of 20, expanding go test ./... && go vet ./... hides the &&, rendering ✓ ran go test ./...… followed by go vet ./.... The wrapping library can return oversized rows at breakpoint boundaries, and the subsequent truncation discards command characters. Expanded view should retain these operators so users can accurately inspect the command.
| rows := strings.Split(lipgloss.Wrap(body, bodyWidth, shellBreakpoints), "\n") | |
| body = ansi.Hardwrap(ansi.Wrap(body, bodyWidth, shellBreakpoints), bodyWidth, true) | |
| rows := strings.Split(lipgloss.Wrap(body, bodyWidth, shellBreakpoints), "\n") |
React: 👍 useful · 👎 wrong · 😕 unclear · 👀 right, but not acting on it
What each reaction means
- 👍 Useful: correct, and you're fixing it or will.
- 👎 Wrong: the finding is incorrect, for example the bug can't happen or the code was misread.
- 😕 Unclear: you can't tell what it means or why it matters.
- 👀 Right, not acting: correct, but intended, out of scope for this PR, a known risk, or too minor.
🤖 Bits Code Review · Open Bits AI session
…ands Leading indentation is repeated on every wrapped row, the first row wraps to its own width, and rows the word wrapper leaves too wide are hard-wrapped instead of truncated. Drop & from the shell breakpoints. Adds indentation() and operators() to fakedata/exec_wrap.star.
Wrap styled segments to a cell width with prefixes, breakpoints, kept indentation and optional ellipsis. Exec invocations and inspection rows now use it instead of ad-hoc ANSI wrappers.
diffrender.Highlight returns styled segments instead of ANSI strings, and Options.Wrap wraps long diff lines under the gutter. Expanded file changes use it; compact rendering is byte-identical.
Changes
Expanded
exec_commandblocks now word-wrap long commands instead of truncating them. Collapsed view is unchanged.in <dir> · timeout · exit) follows the command.│, with soft continuations indented further.lipgloss.Wrap).How to test
BITS_FAKE_BACKEND=1 go run .