Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Fix copying folders into themselves to create copies (#8484)

Thorsten Ball7acd6879db8a
diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs
index 3744a36c00f..c19f293fdc7 100644
--- a/crates/project_panel/src/project_panel.rs
+++ b/crates/project_panel/src/project_panel.rs
@@ -908,7 +908,8 @@ impl ProjectPanel {
.to_os_string();
let mut new_path = entry.path.to_path_buf();
- if entry.is_file() {
+ // If we're pasting into a file, or a directory into itself, go up one level.
+ if entry.is_file() || (entry.is_dir() && entry.id == clipboard_entry.entry_id()) {
new_path.pop();
}