Files
zed/crates/workspace
Dino ad54befbc6 workspace: Ensure panel is activate before opening dock (#66472)
## Summary

When handling a `PanelEvent::Activate` event, the dock where the panel
lives was being opened before the panel from which the event was emitted
had been activated. This ends up calling the `Panel::set_activate`
method for whatever panel was active on the dock before the event was
handled, which could lead to weird cases where the panel from which the
`PanelEvent::Activate` event was emitted ended up having its focus
stolen by another panel.

For example, if the dock's previous active panel was the terminal panel,
calling `Panel::set_activate` would start spawning a terminal session
which could finish loading after the new panel had been activated and
would end up stealing the focus back to itself.

Closes #66197

## Testing

Besides manually testing this, as shown in the screen recordings below,
a test was added to ensure this behavior was fixed when handling the
`PanelEvent::Activate` event but, in order for us to be able to assert
whether a panel's `set_active` method was called,
`TestPanel::activation_history` was introduced.

### Showcase

<details>
  <summary>Before</summary>


https://github.com/user-attachments/assets/1762362f-65fc-49ae-b7ed-9b925e179710


</details>

<details>
  <summary>After</summary>


https://github.com/user-attachments/assets/163b410e-13dd-4f07-8371-01b48f7e3076


</details>


## Self-review

- [x] I've reviewed my diff for quality, security, reliability, and
performance.
- [x] UI changes follow the
[checklist](https://zed.dev/docs/development/ui-checklist).
- [x] Tests cover the new or changed behavior.

Release Notes:

- Fixed an issue where using `pane: reveal in project panel` after
closing the last terminal tab would unexpectedly reopen the terminal
panel
2026-11-04 11:11:39 +00:00
..