Skip to content

feat(browser): redo file operations with Ctrl+Shift+Z - #1120

Open
JoeJoeflyn wants to merge 1 commit into
mainfrom
feat/1117-redo
Open

JoeJoeflyn wants to merge 1 commit into
mainfrom
feat/1117-redo

Conversation

@JoeJoeflyn

@JoeJoeflyn JoeJoeflyn commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator

Description

Adds Finder-style redo for every undoable file operation. Undo keeps a process-wide history stack shared across windows; this adds a parallel redo stack fed by completed undos, so Ctrl+Shift+Z (and Ctrl+Y) re-applies what was just reverted:

  • Trash → re-trashes the restored locations
  • Move → replays the transfer with swapped endpoints, through the same collision dialog as undo
  • Copy → restores the trashed copies from Trash
  • Rename → replays the rename with swapped endpoints
  • Put Back → rides on the UndoEntry::Copy entries restore already records, so undoing a Put Back (re-trash) can itself be redone

Two correctness rules:

  • Invalidation — any new forward operation clears the redo stack (push_pending_undo), matching Finder.
  • Partial replay — undo/redo can half-complete on conflicts. A completed bucket on each pending entry accumulates only items that actually applied, so a partial undo offers a redo for just the reverted portion, and a partial redo regenerates the matching undo subset. Failed operations push nothing — a failed rename undo, for example, offers no redo.

Undo and redo share one replay core (replay_move, replay_rename, replay_entry_locations, resolve_replay_collisions, finish_claimed_replay) parameterized by direction rather than duplicated per direction. Replays reuse the existing provider operations (undo_move, undo_rename, undo_copy, restore) — no new provider API.

Merge/copy-overwrite undos deliberately offer no redo: a merge undo mixes deletions and restores that no single replay operation can re-apply.

Visual evidence

screenrecording-2026-09-18_21-21-14.mp4
  • target/pr-captures/redo-1-restored.png — after Ctrl+Z: todo.txt put back in the listing
  • target/pr-captures/redo-2-retrashed.png — after Ctrl+Shift+Z: todo.txt re-trashed, listing back to four items

How to test

  1. Trash a file (Delete), press Ctrl+Z — the file is put back; press Ctrl+Shift+Z — it is trashed again
  2. Cut+paste a file to another folder, Ctrl+Z, Ctrl+Shift+Z — moves back, then forward again
  3. Copy+paste, Ctrl+Z, Ctrl+Shift+Z — copy trashed, then restored
  4. Rename (F2), Ctrl+Z, Ctrl+Shift+Z — old name, then new name again
  5. Trash, Ctrl+Z, then rename any other file, Ctrl+Shift+Z — nothing happens: the new operation invalidated redo
  6. Multi-select → cut+paste → Ctrl+Z → Skip on a conflict → Ctrl+Shift+Z redoes only the files that actually reverted

Related issue

Closes #1117

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.

feat(operations): redo undone file operations with Ctrl+Shift+Z

1 participant