UNDO HISTORY & CHECKPOINTS
How Many Strokes Can Undo Recover After 41 Separate Edits?
In our local test, 41 separate Pencil strokes left 40 available Undo steps. After using all 40, the first painted pixel remained and Undo was disabled. Forty Redos restored the exact 41-pixel PNG. Save versioned PNGs during longer edits; Undo history did not retain the starting blank state in this sequence.
123 PNGs track the full history sequence
On October 20, 2026, we executed the unmodified production app.js with its original pointer and history listeners. We checked the script against the live file. A minimal DOM adapter connected those handlers to a real native canvas engine. These files were encoded locally, not downloaded from a browser. The adapter ignores a click when its target control is disabled.
We started with a transparent 64×64 texture, Body selected, Pencil size one, full opacity, Mirror off, and green #59E6A8. We drew 41 separate strokes at distinct eligible coordinates. For stroke index i from zero through forty, x was 8 plus i modulo 8 and y was 8 plus the integer part of i divided by 8. The first point was 8,8; the last was 8,13. Each stroke had its own pointer-down and pointer-up pair.
A PNG was saved before painting and after each stroke. The painted-pixel count rose exactly from zero to forty-one, one at a time. Every point was opaque RGBA 89,230,168,255. This control matters: the test did not accidentally count masked clicks or repeated painting over the same coordinate as new visible edits.
We then invoked Undo forty times and saved every result. Each action removed one pixel, taking the count from forty-one down to one. After Undo forty, the only remaining pixel was the very first green point at 8,8. Undo was disabled and Redo remained available. The initial blank state was no longer reachable through the enabled Undo control in this sequence.
We attempted one additional click on the disabled Undo control through the adapter. Its file and hash remained identical to the one-pixel state. This is a control-state check, not a test of programmatically forcing the underlying listener to execute. It does not simulate keyboard shortcuts or a browser-specific input route.
Next we invoked Redo forty times, saving every stage. The pixel count returned from one to forty-one. The final PNG was byte-identical to the original forty-one-stroke file, and Redo was disabled. That recovery confirms the retained history could be traversed in both directions.
| Stage | Painted pixels | Undo / Redo |
|---|---|---|
| blank | 0 | Off / Off |
| paint-1 | 1 | On / Off |
| paint-40 | 40 | On / Off |
| paint-41 | 41 | On / Off |
| undo-1 | 40 | On / On |
| undo-39 | 2 | On / On |
| undo-40 | 1 | Off / On |
| undo-disabled | 1 | Off / On |
| redo-40 | 41 | On / Off |
Independent Pillow decoding checked every PNG's dimensions, painted coordinates, RGBA values, and SHA-256 hash against the raw record. The full ledger lists every stage; its matching file is assets/history-STAGE.png. The reproduction script documents the entire order. This experiment measures one sequence of separate one-pixel strokes, not a long continuous drag, imported images, other tools, browser controls, mobile behavior, or Minecraft rendering.
Keep a version outside the history
- Download a named checkpoint before a long editing session.
- Save another version after completing a section you want to preserve.
- When using Undo, inspect each result and watch the control state.
- Do not assume history can always return to the first blank canvas.
Quick answers
Does one pixel always equal one Undo step?
No such general rule follows. We deliberately used separate pointer-down and pointer-up actions. A continuous drag was not tested.
Does a click have to change pixels to use history?
Our separate masked-click experiment measured a history step with unchanged pixels. Count actual actions and inspect results.
Can Redo recover the original blank state here?
Redo restored the later 41-pixel image. It did not recreate an earlier discarded blank state. The saved PNG checkpoint is independent of this in-memory history.