Repository navigation
Shared text wrapping across the TUI - #38
Merged
Merged
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.
…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.
There was a problem hiding this comment.
Expanded diffs can split a short string literal after an overlong identifier and discard its internal space. The verified one-line suggestion preserves the literal and passes the relevant existing tests.
🤖 Bits Code Review · Commit d083f71
Keeping whitespace by default when wrapping, so text shown as written (diffs, exec commands and output, the approval prompt) no longer loses spaces at soft breaks. Prose opts out with the new TrimSpace option which replaces KeepTrailingSpace.
DavyBello
approved these changes
Oct 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds
internal/tui/textwrapand uses it for wrapped TUI content, including expanded commands, diffs, and prose. Wrapping styled segments keeps their styles attached and preserves text and indentation across rows.The main goal is to be able to properly wrap code / tool outputs when expanded to be able to review the full content.
For example, this source line:
was truncated when expanded
and now renders in an 80-column diff as:
42 + result, err := client.Execute(ctx, command, request, + opts.WithTimeout(timeout), opts.WithRegion(region))Strings and comments stay together when they fit on a row. The wrapper also supports caller-specific breakpoints, prefixes, repeated indentation, trailing spaces, and ellipses.
Migrates chat, approval, permissions, welcome, status, questionnaire, and login text to the new package, and removes the old wrapping ad-hoc code.
How to test it
Run
BITS_FAKE_BACKEND=1 go run .Also added fuzz testing for wrapping and diffrender tests for gutter alignment, string literals, and trailing whitespace.
Checklist