project_panel: Select the whole folder name when renaming (#59390)

# Objective

- Renaming a folder whose name contains a dot pre-selects only the text
before
  the last dot, treating the suffix as if it were a file extension.
- Fixes #59294

## Solution

- `ProjectPanel::rename_impl` computed the rename editor's initial
selection with
`Path::file_stem().len()` for every entry. For a directory such as
`my.folder`,
  `file_stem()` returns `my`, so only `my` was selected.
- Directories have no extension, so select the whole name for them.
Files keep
the existing behavior (the last extension is left unselected for quick
renames).

## Testing

- Added `test_rename_folder_with_dot_selects_whole_name` in
`project_panel_tests.rs`.
It fails before the change (folder selection ends at offset 2 of
`my.folder`) and
passes after (offset 9, the whole name); it also asserts a file still
leaves the
  last extension unselected.
- `cargo test -p project_panel` — all 100 tests pass.
- `cargo clippy -p project_panel --all-targets --all-features -- --deny
warnings` and
  `cargo fmt -p project_panel -- --check` are clean.

## 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 and icon
guidelines)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

---

Release Notes:

- Fixed renaming a folder with a dot in its name selecting only the part
before the dot.

---------

Co-authored-by: Finn Evers <finn.evers@outlook.de>
c0f4059806Ibrahim Khan committed on 6/16/2026, 9:48:24 AM· committed by GitHubparentc3c38c5
2 files changedLine totals unavailable