fix(tui): wrap status line instead of truncating when too long#3054
fix(tui): wrap status line instead of truncating when too long#3054CnsMaple wants to merge 1 commit into
Conversation
The bottom status/data line (model · git · effort · context · cache · jobs · balance, or custom statusline) was truncated with an ellipsis when its content exceeded the terminal width. This lost information with no way to reveal it. Changes: - Replace clampStatusLine (ansi.Truncate) with wrapStatusLine (ansi.Hardwrap) so the data line wraps to additional rows instead of being silently cut. - Add statusLineCount field to chatTUI, computed during Update() via the new computeStatusLineCount() method, so bottomRows() reserves the correct height. - bottomRows() uses statusLineCount instead of hardcoded +2 when available, falling back to 2 for tests that don't set the field. - Update comments to reflect that wrapping is safe in alt-screen mode. The behavior change is transparent to the user: on a wide terminal nothing changes; on a narrow terminal or with many active tags, the data line flows onto extra rows under the composer rather than being cut off with '…'.
|
Good direction — now that the chat view is alt-screen ( Before it can land,
Fix: count both lines through the same |
Problem
The bottom status/data line (model · git · effort · context · cache · jobs · balance, or custom statusline command output) was truncated with
…when its content exceeded the terminal width on narrow terminals or with many active tags. Information was silently lost with no way to reveal it.Solution
Replace truncation with ANSI-aware hard-wrapping so the data line flows onto additional rows instead of being cut off.
Changes
wrapStatusLine(replacesclampStatusLine): usesansi.Hardwrapto wrap text at word boundaries to the given width instead of truncating withansi.Truncate(…).computeStatusLineCount: new method that replicates the data-tag construction from View() and returns the number of terminal rows the status block will occupy after wrapping. Called fromUpdate()so the viewport height is correctly reserved.statusLineCountfield: stored on the model and used bybottomRows()instead of the hardcoded+ 2. Falls back to 2 when uninitialized (e.g. in tests).View(): updated to usewrapStatusLinefor both status rows and the working spinner line.Tests
All existing tests pass. No behavioral change on wide terminals — wrapping only kicks in when the content exceeds
widthcolumns.