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>
@@ -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,