Skip to content

Expose line selection on DiffFilesViewController - #13

Open
gtokman wants to merge 1 commit into
mainfrom
feat/diff-files-line-selection
Open

Expose line selection on DiffFilesViewController#13
gtokman wants to merge 1 commit into
mainfrom
feat/diff-files-line-selection

Conversation

@gtokman

@gtokman gtokman commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

DiffView already ships the line-selection engine (isLineSelectionEnabled, handlers, clearLineSelection) but the sectioned diff never wired it. This exposes it on DiffFilesViewController:

controller.lineSelectionEndedHandler = { filePath, info in
    // info is nil when the selection clears
}
  • Setting either handler enables tap/drag selection over the hunk cells.
  • Callbacks receive the file's display path alongside the LineSelectionInfo, since a sectioned diff spans files.
  • A selection spans one hunk cell at a time; the controller enforces cross-cell exclusivity by clearing the previous cell's highlight (no row reload needed — DiffView.clearLineSelection() exists, unlike the MarkdownTextView case).

Consumed by v0's combined-diff sheet to drive its "Ask v0" selection → composer flow.

Verification

Package builds for iOS simulator; DiffPatchDocumentTests (13) pass. Selection behavior exercised via the consuming app.

🤖 Generated with Claude Code

DiffView already ships the selection engine (isLineSelectionEnabled,
handlers, clearLineSelection) but the sectioned diff never wired it.
Setting lineSelectionHandler / lineSelectionEndedHandler on
DiffFilesViewController now enables tap/drag selection over the hunks;
callbacks receive the file's display path plus the LineSelectionInfo
(nil on clear). A selection spans one hunk cell — the controller
enforces cross-cell exclusivity by clearing the previous cell's
highlight, which DiffView supports directly.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Aug 14, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
markdown-view Ready Ready Preview, v0 Aug 14, 2026 11:43pm

Request Review

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