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

Om Chillure and Smit Barmase created

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [ ] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Closes #53116

Video 

[Screencast from 2026-04-04
19-14-55.webm](https://github.com/user-attachments/assets/d17945d6-b17c-435d-8155-648cd7ba574b)


Release Notes:

- Fixed: File duplication rename now selects the entire filename stem
instead of just the " copy" suffix, allowing users to type a new name
without manually clearing text

---------

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>

Change summary

crates/project_panel/src/project_panel.rs       | 2 +-
crates/project_panel/src/project_panel_tests.rs | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)

Detailed changes

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;
             }
         }

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,