History

calls: Fix off by one in prompts for leaving a call. (#3649)

We've noticed how leaving a call with multiple windows open would still prompt with the popup along the lines of "Do you want to leave the current call?". In Zed1, that popup only showed up when you've had just one window open. The code for prompting did not change at all between zed1 and zed2, but the way we calculate the window count did. Calling AppContext::windows to get all window handles from WindowContext::update essentially excluded the window we were updating (that is the window being closed) from the returned Vec of window handles. I've decided to keep the code as close to original as possible (as the alternative would be to change the \# of workspaces needed for a prompt to pop up). We now query the window handles via a deref to AsyncAppContext, which does not exclude "our" window handle from the returned results. Release Notes: - N/A

Piotr Osiewicz committed 2 years ago

Commit da960ff1 parent 9bce3061 file · +1 −1Browse files

Unified · Split

crates/workspace2/src/workspace2.rs+1−1
@@ -1145,7 +1145,7 @@ impl Workspace { · 1144 unmodified lines
1145 let window = cx.window_handle();1145 let window = cx.window_handle();
1146 1146
1147 cx.spawn(|this, mut cx| async move {1147 cx.spawn(|this, mut cx| async move {
1148 let workspace_count = cx.update(|_, cx| {1148 let workspace_count = (*cx).update(|cx| {
1149 cx.windows()1149 cx.windows()
1150 .iter()1150 .iter()
1151 .filter(|window| window.downcast::<Workspace>().is_some())1151 .filter(|window| window.downcast::<Workspace>().is_some())

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t