-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vim mode :wq
doesn't save a buffer if it's open in another pane
#21059
Comments
I could not reproduce with Zed 0.162.4 on macOS 15.1. What I did:
Both panes looks saved. Maybe this is linux specific bug. |
You saved the file before opening it in another pane @nirs, but the issue here is when the file is open in two panes at once and you do I'm able to reproduce on MacOS, latest Zed version. System specs
|
The file was opened in both panes, and modified in the second pane. The difference is that I did save (:w) not save and quit (:wq). I can reproduce it now with (:wq). |
@ConradIrwin Was taking a look at this one after seeing it in the I've nailed it down to this section of the code 🔽 // Check if this view has any project items that are not open anywhere else
// in the workspace, AND that the user has not already been prompted to save.
// If there are any such project entries, prompt the user to save this item.
let project = workspace.update(&mut cx, |workspace, cx| {
for open_item in workspace.items(cx) {
let open_item_id = open_item.item_id();
if !item_ids_to_close.contains(&open_item_id) {
let other_project_item_ids = open_item.project_item_model_ids(cx);
dirty_project_item_ids
.retain(|id| !other_project_item_ids.contains(id));
}
}
workspace.project().clone()
})?; If the same buffer is open in two different splits, it'll end up being removed from the Is there any tips/hints you can share? It looks like the code doesn't actually check the |
@dinocosta I think we could make that code conditional on the SaveIntent. |
Awesome, thank you for the suggestion! I've opened a Pull Request with the changes – #24561 – I'll move the implementation discussion there, if you're ok with that ✌️ |
Supercedes #24561 Closes #21059 Before this change we would skip saving multibuffers regardless of the save intent. Now we correctly save them. Along the way: * Prompt to save when closing the last singleton copy of an item (even if it's still open in a multibuffer). * Update our file name prompt to pull out dirty project items from multibuffers instead of counting multibuffers as untitled files. * Fix our prompt test helpers to require passing the button name instead of the index. A few tests were passing invalid responses to save prompts. * Refactor the code a bit to hopefully clarify it for the next bug. Release Notes: - Fixed edge-cases when closing multiple items including multibuffers. Previously no prompt was generated when closing an item that was open in a multibuffer, now you will be prompted. - vim: Fix :wq in a multibuffer
Supercedes zed-industries#24561 Closes zed-industries#21059 Before this change we would skip saving multibuffers regardless of the save intent. Now we correctly save them. Along the way: * Prompt to save when closing the last singleton copy of an item (even if it's still open in a multibuffer). * Update our file name prompt to pull out dirty project items from multibuffers instead of counting multibuffers as untitled files. * Fix our prompt test helpers to require passing the button name instead of the index. A few tests were passing invalid responses to save prompts. * Refactor the code a bit to hopefully clarify it for the next bug. Release Notes: - Fixed edge-cases when closing multiple items including multibuffers. Previously no prompt was generated when closing an item that was open in a multibuffer, now you will be prompted. - vim: Fix :wq in a multibuffer
Check for existing issues
Describe the bug / provide steps to reproduce it
When a buffer is open in multiple panes using the
:wq
vim mode command doesn't perform a save.:wq
only saves when a buffer is the last one to be quit.This is an issue for me mainly when renaming symbols accross the project. It only surfaces when all affected files are already open as panes. When I perform a rename, "accept" it by running
:wq
, I'd expect all files in the "rename x -> y" multibuffer to be saved regardless if they are already open elsewhere. I'm guessing it's the same scenario where all files open in the multibuffer are open in other buffers causing the save action to be skipped.Reproduction steps:
:wq
to save and quit the file in one of the splitsReproduction (video):
Screencast_20241122_150111.webm
Environment
Zed: v0.161.2 (Zed)
OS: Linux Wayland endeavouros unknown
Memory: 22.3 GiB
Architecture: x86_64
GPU: AMD Radeon Graphics (RADV RENOIR) || radv || Mesa 24.2.6-arch1.1
If applicable, add mockups / screenshots to help explain present your vision of the feature
No response
If applicable, attach your Zed.log file to this issue.
Zed.log
The text was updated successfully, but these errors were encountered: