mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-27 02:48:34 +00:00
Don't steal focus from context menu when dispatching an action
This commit is contained in:
parent
f832c0074f
commit
06ab2ace72
1 changed files with 6 additions and 4 deletions
|
@ -141,10 +141,12 @@ impl ContextMenu {
|
|||
|
||||
fn cancel(&mut self, _: &Cancel, cx: &mut ViewContext<Self>) {
|
||||
self.reset(cx);
|
||||
cx.defer(|this, cx| {
|
||||
if cx.handle().is_focused(cx) {
|
||||
let window_id = cx.window_id();
|
||||
(**cx).focus(window_id, self.previously_focused_view_id.take());
|
||||
(**cx).focus(window_id, this.previously_focused_view_id.take());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
fn reset(&mut self, cx: &mut ViewContext<Self>) {
|
||||
|
|
Loading…
Reference in a new issue