vim: Fix :wq in multibuffer (#24603)
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
This commit is contained in:
parent
8c780ba287
commit
2f741c8686
11 changed files with 318 additions and 290 deletions
|
@ -2061,7 +2061,7 @@ mod tests {
|
|||
.unwrap();
|
||||
executor.run_until_parked();
|
||||
|
||||
cx.simulate_prompt_answer(1);
|
||||
cx.simulate_prompt_answer("Don't Save");
|
||||
close.await.unwrap();
|
||||
assert!(!window_is_edited(window, cx));
|
||||
|
||||
|
@ -2122,7 +2122,7 @@ mod tests {
|
|||
assert_eq!(cx.update(|cx| cx.windows().len()), 1);
|
||||
|
||||
// The window is successfully closed after the user dismisses the prompt.
|
||||
cx.simulate_prompt_answer(1);
|
||||
cx.simulate_prompt_answer("Don't Save");
|
||||
executor.run_until_parked();
|
||||
assert_eq!(cx.update(|cx| cx.windows().len()), 0);
|
||||
}
|
||||
|
@ -2857,7 +2857,7 @@ mod tests {
|
|||
})
|
||||
.unwrap();
|
||||
cx.background_executor.run_until_parked();
|
||||
cx.simulate_prompt_answer(0);
|
||||
cx.simulate_prompt_answer("Overwrite");
|
||||
save_task.await.unwrap();
|
||||
window
|
||||
.update(cx, |_, _, cx| {
|
||||
|
@ -3156,7 +3156,7 @@ mod tests {
|
|||
},
|
||||
);
|
||||
cx.background_executor.run_until_parked();
|
||||
cx.simulate_prompt_answer(1);
|
||||
cx.simulate_prompt_answer("Don't Save");
|
||||
cx.background_executor.run_until_parked();
|
||||
|
||||
window
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue