mirror of
https://github.com/zed-industries/zed.git
synced 2026-11-19 06:59:22 +01:00
340c703bb2
# Objective - Duplicate in the project panel currently overwrites the system clipboard, and also replaces any pending Copy or Cut in the panel. - Fixes #60891 ## Solution - Duplicate now copies the selected entries directly through the project's copy path instead of running Copy then Paste. - That avoids writing file paths to the system clipboard and leaves the panel's pending Copy/Cut state alone. - Copy, Cut, and Paste keep their existing clipboard behavior. Filename disambiguation, recursive directory copies, undo, selection updates, auto-open, and the rename editor still go through the shared transfer path. ## Testing - Added `test_duplicate_preserves_clipboards`, which checks that Duplicate leaves the system clipboard unchanged, still copies the selected entry, does not paste external clipboard paths, and still honors a pending Cut afterward. - Ran `cargo test -p project_panel test_duplicate_preserves_clipboards`. - Existing `test_create_duplicate_items` still covers the rename-after-duplicate UI. - Reviewers can reproduce the original bug by copying some text, duplicating a file or folder in the project panel, then pasting: the original text should still be there. Copy and Cut should still write paths to the system clipboard as before. - The clipboard write is platform-agnostic. I did not do a separate Windows/Linux UI pass beyond the unit test. ## Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content adheres to Zed's UI standards ([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) and [icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md) guidelines) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable --- Release Notes: - Fixed duplicating files or folders in the project panel overwriting clipboard contents. --------- Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>