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.

project_panel: Fix duplicating a file only selects the copy suffix (#53146)

Om Chillureae4404f148b6
diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs
index afb0d811fa3..3d10903eaa7 100644
--- a/crates/project_panel/src/project_panel.rs
+++ b/crates/project_panel/src/project_panel.rs
@@ -3040,7 +3040,7 @@ impl ProjectPanel {
new_path.push(RelPath::unix(&new_file_name).unwrap());
- disambiguation_range = Some(file_name_len..(file_name_len + disambiguation_len));
+ disambiguation_range = Some(0..(file_name_len + disambiguation_len));
ix += 1;
}
}
diff --git a/crates/project_panel/src/project_panel_tests.rs b/crates/project_panel/src/project_panel_tests.rs
index 603cfd892a2..a49b32a6946 100644
--- a/crates/project_panel/src/project_panel_tests.rs
+++ b/crates/project_panel/src/project_panel_tests.rs
@@ -1254,8 +1254,8 @@ async fn test_copy_paste(cx: &mut gpui::TestAppContext) {
let file_name_selection = &file_name_selections[0];
assert_eq!(
file_name_selection.start,
- MultiBufferOffset("one".len()),
- "Should select the file name disambiguation after the original file name"
+ MultiBufferOffset(0),
+ "Should select from the beginning of the filename"
);
assert_eq!(
file_name_selection.end,