mirror of
https://github.com/zed-industries/zed.git
synced 2026-11-20 15:40:29 +01:00
290cbcb9cb
# Objective Fix an issue in SSH remote mode where reopening a newly created file at a path that was previously renamed could incorrectly reuse the buffer for the renamed file. ## Solution When handling UpdateBufferFile, remove the buffer's previous path from path_to_buffer_id when the file path changes. ## Testing Tested manually on Linux using SSH remote mode. Reproduction before the fix: touch A Open A from the project panel mv A B touch A Open the new A from the project panel Before the fix, opening A reused the buffer for B. After the fix: B continues to use the original buffer. The recreated A opens as a separate buffer. Renaming an opened remote file still updates the existing buffer to the new path correctly. ## 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](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) and [icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md) guidelines) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - Fixed an issue in SSH remote mode where reopening a newly created file at a path that was previously renamed could incorrectly reuse the buffer for the renamed file. --------- Signed-off-by: xiaoff <xiaoff0019@outlook.com> Co-authored-by: Kirill Bulatov <kirill@zed.dev>