Conversation
CollapsedText appended the full "..." marker even when the preview had no room left, so the row could be up to 3 columns wider than the width it was given. In pi this makes the TUI throw "Rendered line N exceeds terminal width" and exit (seen at 24 columns with a 217-line ffgrep result). When previewWidth < markerWidth, return only the suffix. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthrough
ChangesCollapsed text rendering
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~5 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to The narrow preview change preserves the rendered-line width limit. No identified issue prevents merging. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Problem
CollapsedText.render(packages/pi-fff/src/index.ts) can return a row wider than thewidthit was given. When the first-line preview does not fit, it slices the preview tomax(0, previewWidth - markerWidth)columns but still appends the full 3-column...marker, so the row ismarkerWidth + 1 + suffixWidthcolumns even whenpreviewWidth < markerWidth.I hit this while using the pi coding agent with pi-fff installed (agent was mid-task). pi-tui requires every rendered line to be
<= width; otherwise the TUI stops and throwsRendered line N exceeds terminal width, so the whole agent exits and the in-flight work is lost. Seen with@ff-labs/pi-fff0.11.0 on@earendil-works/pi-coding-agent0.99.2, in a 24-column pane, after anffgrepcall returned 218 lines:The tool box is
Box(1,1), so the component gets 22 columns; the suffix... (217 more lines)is 20, leavingpreviewWidth = 1; the output was... ... (217 more lines)(24 columns) plus 1 left pad = 25.Fix
If
previewWidth < markerWidth, return only the suffix. TheMath.max(0, ...)clamp is no longer needed.Verification
bun test test/: 96 pass.Box(1,1),visibleWidthandsliceByColumn: 104 of 7800 combinations overflowed before, 0 after. Wider layouts produce the same output as before.Side effect: at very narrow widths the collapsed row drops the leading
...and shows only... (N more lines).🤖 Generated with Claude Code