mirror of
https://github.com/zed-industries/zed.git
synced 2026-11-19 06:59:22 +01:00
917559da35
## Summary The thread switcher only cycles: `ctrl-tab` steps forward, `ctrl-shift-tab` steps back, and releasing the modifier confirms. Its view only handles `menu::Confirm`, `menu::Cancel` and `agents_sidebar::ToggleThreadSwitcher`, so the global `menu::SelectNext` / `menu::SelectPrevious` bindings – arrow keys, `ctrl-n` / `ctrl-p` – and `menu::SelectFirst` / `menu::SelectLast` do nothing while it is open. With threads from several workspaces in the list, reaching the nth entry costs n−1 presses of the trigger. This PR makes the switcher handle those four actions, like the other modal lists in Zed: - Next and previous wrap around and preview the selected thread without confirming it, the same way the cycle bindings do. - `ctrl-up` / `ctrl-down` are bound in the `ThreadSwitcher` context, mirroring the tab switcher, so the selection can move while the modifier that opened the switcher is still held. On macOS, `ctrl-up` / `ctrl-down` are taken by Mission Control and App Exposé by default, so they may never reach Zed – `ctrl-n` / `ctrl-p` still work with `ctrl` held. The thread switcher paragraph in `docs/src/ai/parallel-agents.md` mentions the new keys. Proposed in discussion #66923. https://github.com/user-attachments/assets/b5138dab-3e16-4e2a-a99a-a5b7708a66bc ## Testing - `test_thread_switcher_menu_navigation_wraps_without_confirming` covers wrapping in both directions, `SelectFirst` / `SelectLast`, and checks that stepping previews a thread without confirming it or recording an access – only `menu::Confirm` does. - `cargo test -p sidebar` and `./script/clippy -p sidebar` pass locally. - Tested manually on macOS: open the switcher with `ctrl-tab`, keep `ctrl` held and step with `ctrl-n` / `ctrl-p`, release to confirm. ## 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: - Added keyboard navigation to the thread switcher: arrow keys, `ctrl-n` / `ctrl-p`, Home / End, and `ctrl-up` / `ctrl-down` while the switcher's modifier is held.