## Context When a file is renamed via the project panel while open in an editor, Zed would restore the old (no longer existing) path on reload . On rename, `language::Buffer` emits `BufferEvent::FileHandleChanged`, which propagates to `multi_buffer::Event::FileHandleChanged` → `EditorEvent::TitleChanged`. However, `should_serialize()` only matched `Saved | DirtyChanged | BufferEdited`, so no re-serialization was triggered and the `editors` DB table retained the stale `abs_path`. The fix adds a dedicated `EditorEvent::FileHandleChanged` variant, emits it alongside `TitleChanged` when the buffer's file handle changes, and adds it to `should_serialize()`. Since `Editor::serialize()` already reads the current path from the buffer at call time, this naturally writes the new path to the DB. Closes #51629 ## How to Review Three files edited: - `editor.rs`: splits `FileHandleChanged` into its own arm and emits the new event variant - `items.rs`: adds `FileHandleChanged` to `should_serialize` - `items.rs` (test): `test_file_handle_changed_on_rename` does a full rename via `Project::rename_entry` and asserts the event fires and the buffer path updates ## 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 Release Notes: - Fixed renamed files being reopened with their old path after a restart **Important remark :** This pull request is a follow-up on the review of @SomeoneToIgnore on this pull request, https://github.com/zed-industries/zed/pull/51717, which was inadvertently closed because I mistakenly deleted my previous fork of the zed repo, sorry for any inconvenience caused by this Manual test video below : [Screencast from 2026-03-16 23-28-46.webm](https://github.com/user-attachments/assets/ff2e3259-ae26-4655-83b8-f693e84306d2)
2 files changedLine totals unavailable