feat(logs): opt-in soft-wrap mode (w) and → truncation indicator in /ps:logs - #92
Merged
aliou merged 1 commit intoAug 22, 2026
Conversation
378-kaiabot
Bot
force-pushed
the
fix/log-viewer-line-wrapping
branch
from
August 17, 2026 14:15
bd6f0de to
4ecaca5
Compare
Issue #75: long log lines were hard-clipped with no way to see the full content and no indication that content was lost. - Add grapheme-aware wrapToWidth alongside truncateToWidth: walks graphemes, expands tabs to 3-column stops, never splits wide characters across row boundaries, and carries open SGR state across wrapped chunks so colours survive wrapping. Continuation rows wrap to a narrowed width when a continuation indent is set. - Add renderLogLineWrap in shared log-line.ts: wraps instead of truncating, applies the same sanitization and stream/match emphasis, and prefixes every continuation row with a dim ↳ marker so wrapped chunks are visually distinct from new log lines. - Show a → indicator when a line is truncated (wrap off) so clipped output is visible in /ps preview, dock, and /ps:logs. - Wire a w-key toggle into LogFileViewer and the /ps:logs overlay: viewport (scroll, anchor, search jumps, status bar) operates on display rows when wrapping; wrap state persists across tab round-trips via the viewer cache. Truncation remains the default. Closes #75
378-kaiabot
Bot
force-pushed
the
fix/log-viewer-line-wrapping
branch
from
August 17, 2026 14:26
4ecaca5 to
9e9e1f7
Compare
378-kaiabot
Bot
changed the base branch from
fix/intentional-stop-context-notification
to
debug/programmatic-process-control
August 17, 2026 14:27
378-kaiabot
Bot
force-pushed
the
fix/log-viewer-line-wrapping
branch
from
August 17, 2026 16:48
9e9e1f7 to
545874a
Compare
aliou
marked this pull request as ready for review
August 18, 2026 18:39
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.
Note
Automated pull request by Pi, model
aperture/hf:zai-org/GLM-5.2. Implemented and validated empirically againstaliou/pi-processes. The bug was confirmed onmainby the #75 repro; the fix is verified onthis branch. See the local run log for the full investigation.
Problem
In the
/ps:logsoverlay (and the/pspreview and dock, which share the renderer), any log linewider than the viewport was hard-clipped to the row width with no way to see the rest and no
indication that content was lost.
renderLogLinecalledtruncateToWidth(text, textWidth, "", true)— an empty ellipsis — and
LogFileViewer.render()mapped exactly one log line to one display row,so content beyond the viewport width was silently dropped (#75).
Confirmed before the fix: rendering
the quick brown fox jumps over the lazy dogat width 10 in aLogFileViewerproduced a single row wherelazywas invisible, with no marker that the line wasclipped.
Changes
extensions/shared/truncate.ts— addwrapToWidth(text, maxWidth, contIndent = 0), agrapheme-aware soft-wrap sibling of
truncateToWidth. Walks graphemes with the sameIntl.Segmenter+readAnsiSequencemachinery, expands tabs to 3-column stops, never splits awide character across a row boundary, and carries open SGR state across wrapped chunks (each
chunk re-opens accumulated SGR, each open chunk ends with a reset). With
contIndent > 0, thefirst row wraps to
maxWidthand continuation rows tomaxWidth - contIndent, mirroringless.extensions/shared/log-line.ts— addrenderLogLineWrap(line, options): same sanitize + tonepipeline as
renderLogLinebut returnsstring[]of display rows, prefixing every continuationrow with a dim
↳marker so wrapped chunks are visually distinct from new log lines. ChangerenderLogLine's ellipsis from""to"→"so truncated lines (wrap off) are visibly marked inall three surfaces.
extensions/processes-logs/components/log-file-viewer.ts— addwrapEnabledstate withtoggleWrap()/isWrapEnabled(). When wrapping,render()builds a flat display-row list fromthe visible logical lines (each row tagged with its source line for emphasis), and the viewport —
anchorEnd,scrollBy,scrollToTop/Bottom, search jumps, and theL<end>/<total>status —operates on display rows via
totalDisplayRows(). Awrapindicator is shown in the status bar;the toggle persists across tab round-trips through the existing viewer cache.
extensions/processes-logs/components/log-overlay-component.ts— wire thewkey totoggleWrap()and showw: wrap(accent when on) in the footer key hints..changeset/log-viewer-line-wrapping.md— minor-version changeset.Truncation remains the default for the
/pspreview, the dock, and the logs overlay — wrap isopt-in per viewer, exactly as #75 specifies.
Verification
pnpm typecheck✅pnpm lint✅pnpm test✅ (605 passed, 59 files)Closes #75
Stacked on #93 — merge that first.
Run host:
golden-hugo-lefevre· Session:01a00f8d-2ec0-7125-b9b7-8f0cb1c0c50f· Model:aperture/hf:zai-org/GLM-5.2