Repository navigation
Conversation
⌘Z reverts the last file operation and ⇧⌘Z does it again, like Finder: items moved to the Trash are put back where they were, a rename gets its old name back (on servers too), and a new folder or file goes to the Trash (on servers: deleted while still empty). Undo and Redo are in the Edit menu and the command palette; text fields and the terminal keep ⌘Z. Nothing is ever replaced: when the original place is taken, the step stays and can be tried again. Without Full Disk Access, Finder puts items back from the Trash. Copies and moves aren't recorded yet.
Contributor
Author
|
Closing in favour of #5, as discussed. The implementation stays on the branch in my fork in case it's useful. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
Items moved to the Trash couldn't be brought back with ⌘Z; Manta had no Undo for file operations at all (only Batch Rename had its own). This adds Undo (⌘Z) and Redo (⇧⌘Z), like Finder, in the Edit menu and the command palette:
Details:
crates/app/src/undo.rs: each history entry is the operation that reverts one step; running it yields the operation that reverts that, which goes on the other stack. Session only, 100 steps per stack, a new operation clears Redo. Steps run on the worker one at a time.Trasher::put_backmoves items out of the Trash. Without Full Disk Access (macOS keeps apps out of~/.Trash), it asks Finder, as Empty Trash already does; the paths are passed asosascriptarguments, never into the script text.README.md→readme.md) is undone correctly on case-insensitive disks.crates/ops, which would extend its public API, so I'd like to discuss that separately first.How to test
In a test folder, with
cargo run -p manta:notiz.txt, create a newnotiz.txtoutside Manta (echo new > notiz.txt), ⌘Z: error, new file untouched. Delete it, ⌘Z: the original is back.New tests:
crates/app/src/undo_ux_tests.rs(UI tests with the fake Trash) and unit tests inundo.rs. Not tested automatically: the real~/.Trashand the Finder fallback (checked by hand with Full Disk Access only).Checklist
cargo fmt --all --checkpassescargo clippy --workspace --all-targets -- -D warningsreports no warningsscripts/test.shpasses (andscripts/test.sh fullif backends, transfers or the terminal changed)python3 scripts/i18n/check.pyreports 0 problemsMANTA_UPDATE_GLOSSARY=1 cargo test -p manta glossary)docs/manual/, all 7 languages) and developer docs are updated, or no update is neededdocs/third-party-licenses.mdis regenerated if dependencies changed (scripts/third-party-licenses.py) (no dependency changes)