Skip to content

Keep recent captures replayable, and walk them inside a snip - #19

Merged
ursasi merged 1 commit into
mainfrom
feat/history-replay
Oct 26, 2026
Merged

ursasi merged 1 commit into
mainfrom
feat/history-replay

Conversation

@ursasi

@ursasi ursasi commented Oct 26, 2026

Copy link
Copy Markdown
Owner

Snipaste's history replay, which Peg was missing.

What is stored

Every finished snip saves:

  • the frozen full frame as JPEG (quality 0.9) — these are working copies, so 50 of them stay in the low hundreds of MB at worst, not gigabytes;
  • a small JSON with the selection and the marks (tool, colour, width, points, text, size).

Under ~/Library/Application Support/Peg/sessions/, next to each other, so the saved screenshots in the pictures folder are untouched.

Retention

A fixed count, not a time window: 10 / 30 / 50 in settings, default 30. When the limit is reached the oldest pair is deleted as the new one lands.

Using it

Inside a snip overlay:

key action
, previous capture (older)
. next capture (newer), and finally back to the live frame

The frame, the selection and the annotations all come back, and everything is editable immediately — no separate "reopen for editing" step, which was the point. Walking forward past the newest entry restores the live capture and its own selection (or lack of one).

Both keys are ordinary entries in the settings window, so they can be rebound; they are deliberately not registered as global hot keys, only handled by the overlay.

Verification

check result
finish a snip with a caption session-*.jpg + session-*.json written
new snip, press previous history: showing entry 0 shapes=1, the old frame with its 800×600 selection and the caption, bar active
press next history: back to the live frame, live content, live selection restored
limit SessionStore.prune() keys off Prefs.sessionLimit; 10/30/50 in settings

Focus-stealing is refused while another app is in front, so the key path was exercised through a history:prev / history:next debug command; the key handler itself is a two-line match on key code plus modifiers.

Snipaste's trick, which Peg was missing: a capture saved as a frozen frame plus
its selection and marks, so a region that was framed badly — or annotated badly
— can be redone later instead of starting from a new screenshot of a screen that
has moved on.

- Every finished snip stores the full frame (JPEG, quality 0.9) and a small JSON
  of the selection and the marks under Application Support/Peg/sessions.
- A fixed count is kept, 10 / 30 / 50 in settings, default 30. Reaching the limit
  drops the oldest; there is no time-based expiry.
- Inside a snip, `,` walks back and `.` walks forward. The frame, the selection
  and the marks all come back, editable straight away — no separate "reopen"
  step. Walking forward past the newest entry returns to the live capture and
  its own selection.
- The two keys are ordinary shortcuts in settings (plain `,` and `.` by default)
  but are never registered as global hot keys; they only act on the overlay.
@ursasi
ursasi merged commit 9b34c46 into main Oct 26, 2026
1 check passed
@ursasi
ursasi deleted the feat/history-replay branch October 30, 2026 10:47
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