Skip to content

Copy an image in the diff to the clipboard with a right-click - #139

Merged
JBlaak merged 3 commits into
mainfrom
copy-diff-image
Oct 19, 2026
Merged

JBlaak merged 3 commits into
mainfrom
copy-diff-image

Conversation

@JBlaak

@JBlaak JBlaak commented Oct 19, 2026 •

Copy link
Copy Markdown
Owner

Getting an image out of the diff meant finding the file on disk; now a right-click on it copies it.

Summary

  • Which image: the side you right-click in side-by-side (or the only side of an added or deleted image), the side of the divider in swipe, the side showing in blink, and the after in onion skin and pixel diff, where both are drawn at once
  • What lands on the clipboard: a PNG of the first frame, whatever the format, so an SVG comes out as pixels and an animated GIF as a still
  • Feedback: a "Copied to clipboard" toast shows over the bottom of the card for a moment, once main has the PNG
  • How: the card encodes the image in the renderer and sends it over a new clipboard-write-image channel; main writes it with clipboard.writeImage, going through the host for the same reason text copying does
  • SideStage takes a side instead of a label, so the stage under the pointer can be told apart

Worth knowing

  • Right-click copies straight away, with no context menu
  • Flaky image card e2e: picking swipe makes the logo card taller, which can bring in a scrollbar just after the card fits, narrowing the stage by its width. The view isn't refit then, so 0 landed on a slightly different fit than the one the test had saved. The test now compares against the fit for the stage as it is. The app itself still leaves the view about 15px too wide in that case.

Tests

  • Unit: test/image-compare-copy.test.ts, which side each mode copies
  • E2e: session-work-images.spec.ts right-clicks Before, After and a card in blink, checks the size of each PNG sent to the stubbed clipboard, and that the toast shows and goes
  • The image card e2e passed 20 of 20 repeated runs locally after the fix, where it had failed 2 of 5
  • The real clipboard write was tried by hand in the dev app

🤖 Generated with Claude Code

JBlaak and others added 3 commits October 19, 2026 13:00
A right-click on an image card's stage copies one side as a PNG of its
first frame: the side under the pointer in side-by-side, the side of the
divider in swipe, the side showing in blink, and the after in onion skin
and pixel diff. It goes to the clipboard through main, like text does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Where scrollbars always show, the icon card loading below the logo grows
the page and a scrollbar narrows the logo's stage after its fit was read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e live stage

A "Copied to clipboard" toast shows over the image card for a moment once
main has the PNG; a PNG that will not encode now fails instead of passing
silently. The image card e2e compared 0 against the fit it read right after
picking swipe, but swipe's taller card can bring in a scrollbar after that
fit and narrow the stage; it now compares against the fit for the stage as
it is, in place of waiting for the icon card.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JBlaak
JBlaak merged commit b9e22de into main Oct 19, 2026
4 checks passed
@JBlaak
JBlaak deleted the copy-diff-image branch October 19, 2026 12:22
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