terminal_view: Don't steal focus from an open modal when terminals appear (#63097)
# Objective
Pressing the recent projects shortcut right after launching Zed opens
the picker, which then dismisses itself a moment later. The terminal
panel takes focus after the keystroke, and the picker cancels on blur.
## Solution
Two paths focused the panel unconditionally at the end of async startup
work: the tail of `TerminalPanel::restore_serialized_state`, and
`RevealStrategy::Always` in `add_terminal_shell` (which
`finish_restoration` uses to spawn the default shell). Both now check
`has_active_modal`, as `add_center_terminal` already did. For the shell
path the check is at reveal time, because the spawn is itself async.
## Testing
Three tests in `terminal_panel.rs`. Two of them fail with the source
change reverted. Manually tested on Linux.
## Before:
https://github.com/user-attachments/assets/66ab9860-b381-46da-8f85-f7a58c5157e6
## After:
https://github.com/user-attachments/assets/57583fe2-3c8a-40e0-9130-bbb612c1e158
Release Notes:
- Fixed the terminal panel dismissing an open modal when terminals
finish restoring during startup
93f07f6d17Mikhail Butvin committed on 8/24/2026, 8:56:06 AM· committed by GitHubparent6805d95