zed icon indicating copy to clipboard operation
zed copied to clipboard

Saving a multibuffer, with an excerpt to a deleted file, resurrects the file

Open JosephTLyons opened this issue 1 year ago • 2 comments

Check for existing issues

  • [X] Completed

Describe the bug / provide steps to reproduce it

  • If you delete a file from Zed while the file is open, Zed closes the buffer
  • If you delete a file from Zed while a multi-buffer is referencing an excerpt from the file, the exceprt remains and the status of the multi-buffer is changed to dirty.

These two are inconsistent with one another, and a bit more annoyingly, if you save the multi-buffer, the file is silently resurrected. Many times, you may not realize that the dirty status of the multi-buffer has anything to do with the deleted file, since many other exceprts could be in view and/or the multi-buffer was already in a dirty state and you come back and save it later on.

A potential solution is to remove the excerts of deleted files from multi-buffers. This makes things consistent with what happens with an open singleton buffer when its file is deleted and prevents the file from being included in the multi-buffer, so future saves don't resurrect them. Maybe there is some rationale for not doing this, or a way to prevent the side effects of resurrecting a deleted file when saving a multi-buffer that contains an excerpt to one.

Environment

Zed: v0.127.0 (Zed Nightly) OS: macOS 14.3.1 Memory: 64 GiB Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

No response

JosephTLyons avatar Mar 09 '24 11:03 JosephTLyons

Let's chat about the potential solution here before anyone jumps on it.

JosephTLyons avatar Mar 11 '24 16:03 JosephTLyons

https://github.com/zed-industries/zed/pull/9813 might have helped with this: now, unless the deleted file was edited in the multibuffer, it should not touch it on save.

SomeoneToIgnore avatar Apr 18 '24 09:04 SomeoneToIgnore