refactor(ui): unify clipboard line clipping - #860
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
Greptile SummaryThis refactor represents clipboard output as uniformly clipped visual lines while preserving distinct empty-line policies for decorated and code-only output.
Confidence Score: 5/5The PR appears safe to merge with no actionable correctness, security, or maintainability issues identified. The unified clipper preserves normalized selection boundaries, terminal-cell slicing, pane-relative origins, header inclusion, and the intentional difference between decorated and code-only blank lines. Important Files Changed
Reviews (1): Last reviewed commit: "refactor(ui): simplify clipboard visual-..." | Re-trigger Greptile |
1 task
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.
Problem
renderCopySelectionTextduplicated visual-row clipping, terminal-cell slicing, and first/last-column handling across decorated and code-only clipboard output. The paths differed in subtle but intentional ways, making future changes error-prone.Approach
CopyVisualLineshape with visual row, global origin, text, and empty-line policy;This is a behavior-preserving maintenance refactor.
renderCopySelectionTextcomplexity drops from 56 to 29.Validation
Tested on Linux:
bun test src/ui/components/panes/copySelection.test.ts— 51 passed;main;bun run typecheck;bun run lint;bunx oxfmt --check src/ui/components/panes/copySelection.ts src/ui/components/panes/copySelection.test.ts;git diff --check main...HEAD.No visual evidence is included because clipboard text is covered directly and interaction/rendering behavior is unchanged.
This PR description was generated by Pi using OpenAI GPT-5.6 Sol