Skip to content

fix(ui): keep wrapped code-row geometry aligned - #858

Open
benvinegar wants to merge 2 commits into
mainfrom
fix/unify-code-row-layout
Open

fix(ui): keep wrapped code-row geometry aligned#858
benvinegar wants to merge 2 commits into
mainfrom
fix/unify-code-row-layout

Conversation

@benvinegar

Copy link
Copy Markdown
Member

Problem

Wrapped row measurement and rendering independently calculated code widths. New-side note guides reserved a terminal column during rendering but not geometry measurement, so a row could measure as one line and render as two at an exact wrap boundary. Add-note column reservation could similarly drift from clipboard and word-selection layout.

Approach

  • introduce one planned code-row layout for split and stack rows from the complete PlannedReviewRow;
  • reuse its pane, prefix, gutter, guide, badge, and content widths across geometry, rendering, clipboard text, and word selection;
  • pass the planned row directly into DiffRowView rather than reconstructing guide/anchor facts;
  • keep wrapped line-count measurement lazy and memoized so paint paths do not pay for unused measurement;
  • add split/stack parity tests for guide and add-note wrap boundaries.

This stays in the terminal rendering/geometry layer and does not change shared semantic review behavior.

Validation

Tested on Linux:

  • focused rendering, geometry, copy-selection, and UI suites — 143 passed;
  • bun run test:integration — 132 passed, 1 platform skip;
  • bun run typecheck;
  • bun run lint;
  • bun run deps:check;
  • focused oxfmt --check across all changed source/test files;
  • git diff --check main...HEAD.

Before rebasing, the full suite reached 1,539 passed and 7 skipped with one environment-sensitive failure in unchanged src/extensions/hostRuntimeModules.test.ts. That same test fails on current main because an outside temporary import unexpectedly resolves the repository's React installation.

Wrapped-CJK benchmark medians were effectively flat against the original baseline, with no systematic regression. Automated PTY and TTY transcript coverage passed; no manual visual capture is included because the change corrects invisible geometry parity rather than intentional styling.

Limitations

Extremely narrow forced split layouts retain the existing minimum-pane-width behavior from resolveSplitPaneWidths; this PR does not change that policy.

This PR description was generated by Pi using OpenAI GPT-5.6 Sol

@vercel

vercel Bot commented Aug 26, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
hunk-web Ignored Ignored Aug 26, 2026 1:25pm

Request Review

@greptile-apps

greptile-apps Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR centralizes split and stack code-row layout planning so geometry, rendering, clipboard output, and word selection use consistent widths.

  • Passes complete planned rows into the primary diff-row renderer.
  • Accounts for note-guide and add-note columns during wrapped-row measurement.
  • Keeps wrapped-height calculation lazy and memoized within each layout plan.
  • Adds split and stack boundary tests for geometry, copying, and word selection.

Confidence Score: 5/5

The PR appears safe to merge with no concrete correctness, security, or maintainability issue identified.

The changed geometry, rendering, clipboard, and selection paths consistently consume the shared row-layout policy, and the investigated edge cases did not establish a reachable regression.

Important Files Changed

Filename Overview
src/ui/diff/renderRows.tsx Introduces the shared, lazy code-row layout plan and reuses it for measurement and rendering without an established regression.
src/ui/diff/diffSectionGeometry.ts Measures planned rows using the shared layout, including wrapped add-note column reservation.
src/ui/diff/DiffSectionBody.tsx Passes complete planned rows to DiffRowView while preserving existing row memoization and annotation behavior.
src/ui/components/panes/copySelection.ts Uses planned prefix, gutter, pane, and reservation widths for clipboard and word-selection coordinate conversion.
src/ui/components/panes/DiffPane.tsx Threads the add-note reservation policy into copy-selection context consistently with geometry and rendering.
src/ui/diff/codeRowLayout.test.ts Adds focused parity coverage for shared split and stack layout planning.
src/ui/components/panes/copySelection.test.ts Adds exact-boundary tests covering wrapped geometry, decorated and code-only copies, and continuation-row word selection.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Row[PlannedReviewRow] --> Plan[planCodeRowLayout]
  Plan --> Geometry[Wrapped row geometry]
  Plan --> Render[Terminal rendering]
  Plan --> Copy[Clipboard slicing]
  Plan --> Selection[Word selection]
  Geometry --> Bounds[Shared row boundaries]
  Render --> Bounds
  Copy --> Bounds
  Selection --> Bounds
Loading

Reviews (1): Last reviewed commit: "fix(ui): align wrapped copy reservation" | Re-trigger Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant