Skip to content

Fix select-all copy in the diff viewer#116

Merged
Emanuele-web04 merged 1 commit into
Emanuele-web04:codex/fixesssfrom
Zeus-Deus:feature/60-bug-select-all-and-copy-from-the-diff-file-viewer-doesn-t
May 14, 2026
Merged

Fix select-all copy in the diff viewer#116
Emanuele-web04 merged 1 commit into
Emanuele-web04:codex/fixesssfrom
Zeus-Deus:feature/60-bug-select-all-and-copy-from-the-diff-file-viewer-doesn-t

Conversation

@Zeus-Deus
Copy link
Copy Markdown

Closes #60

Problem

The diff viewer is virtualized, so only a handful of rows are ever in the DOM. Selecting all and copying a large file (e.g. 6k lines) only put those few rendered rows on the clipboard.

Fix

  • Serialize the full diff from the parsed model instead of relying on mounted DOM rows.
  • Intercept the copy event at the document level. The diff renders into shadow DOM, so the copy event never reaches the viewport element — Cmd/Ctrl+A inside the viewport arms the gesture, and the next copy writes the complete diff.
  • The existing "Copy" button now uses the same serialized text.

Testing

  • Unit tests for the serializer (including a 6k-line diff) and the select-all gesture logic.
  • Verified in-browser with a 12k-line working-tree diff: select-all + copy, the Copy button, and partial selections all behave correctly.

The diff viewer is virtualized, so selecting all and copying only put the
handful of rendered rows on the clipboard instead of the full file.

Serialize the whole diff from the parsed model and intercept the copy
event at the document level (the diff renders into shadow DOM, so the
copy event never reaches the viewport element). Cmd/Ctrl+A inside the
viewport arms the gesture; the next copy then writes the complete diff.
The existing Copy button now uses the same serialized text.
@github-actions github-actions Bot added size:L vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels May 14, 2026
@Emanuele-web04 Emanuele-web04 changed the base branch from main to codex/fixesss May 14, 2026 21:42
@Emanuele-web04 Emanuele-web04 merged commit e0624b2 into Emanuele-web04:codex/fixesss May 14, 2026
6 of 7 checks passed
@Marve10s
Copy link
Copy Markdown
Contributor

Thanks for taking this on. The underlying bug looks valid: a virtualized diff cannot rely on the mounted DOM rows for full-file select-all copy.

Please tighten this PR before merge:

  1. Clean up the added explanatory comments. Keep only comments that document non-obvious behavior that future maintainers could not infer from the code.
  2. Keep the PR scoped to the select-all/copy bug. Do not add unrelated edits, formatting churn, or extra test expansion beyond what is needed for this bug.
  3. Make sure the final fix is the smallest proper fix for the reported behavior: full-diff copy should use the parsed diff model, partial/native selections should continue to behave normally, and the Copy button should share the same serialization path.

@Zeus-Deus
Copy link
Copy Markdown
Author

Addressed the comment cleanup in a follow-up: #120. Kept it scoped to just that — one short line per function to match the rest of the file.

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

Labels

size:L vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Select all and copy from the diff file viewer, doesn't copy all the content into the clipboard

3 participants