# Objective Ensure that the bindings displayed in the Git Panel's context menu do not change between the first and subsequent frames. ## Solution Git panel context menus could briefly display bindings from the generic `GitPanel` context before switching to the more specific `ChangesList` bindings. This was especially noticeable with Vim mode enabled, where "Stage All" changed from `ctrl-cmd-y` to `shift-x`. Since `GitPanel::dispatch_context` relies on `FocusHandle::contains_focused` to be `true` in order to add the `menu` and `ChangesList` contexts it could fail on the first frame the context menu is shown, as the menu's focus handle is absent from the previous frame's dispatch tree when first focused. The simplest fix in this case is to fallback to `GitPanel::context_menu::is_some()` in case `GitPanel::focus_handle::contains_focused` returns `false`. ## Testing Tested both manually as well as updated an existing test to ensure that, when the context menu is first focused, both the `menu` and `ChangesList` context are still present, even if no frame is rendered. ## Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [ ] Unsafe blocks (if any) have justifying comments - [ ] The content adheres to Zed's UI standards ([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) and [icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md) guidelines) - [x] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable ## Showcase <details> <summary>Before</summary> Notice how the "Stage All" binding changes from `ctrl-cmd-y` (macOS) to `shift-x` (vim). https://github.com/user-attachments/assets/1d2e2de5-dce4-422c-8d63-4bcd93375431 </details> <details> <summary>After</summary> https://github.com/user-attachments/assets/79e74c3f-8358-4e7c-8eb9-74fa36adde67 </details> ## Future Work It's still possible for the bug to show up the first time the very first time the context menu is actually opened, if the Git Panel was not previously focused, that is, using `right-click` on the Git Panel while the editor was focused, for example. I suspect this has to do with how `Window::highest_precedence_binding_for_action_in` also relies on the previous frame's dispatch tree, at which point the `GitPanel` was not yet available in the context. --- Release Notes: - Fixed issue where the bindings shown in the Git Panel's context menu would change after the first frame.
Zed
Welcome to Zed, a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Installation
On macOS, Linux, and Windows you can download Zed directly or install Zed via your local package manager (macOS/Linux/Windows).
Other platforms are not yet available:
- Web (tracking discussion)
Developing Zed
Contributing
See CONTRIBUTING.md for ways you can contribute to Zed.
Also... we're hiring! Check out our jobs page for open roles.
Licensing
Zed source code is licensed primarily under GPL-3.0-or-later, with Apache-2.0 components where marked.
License information for third party dependencies must be correctly provided for CI to pass.
We use cargo-about to automatically comply with open source licenses. If CI is failing, check the following:
- Is it showing a
no license specifiederror for a crate you've created? If so, addpublish = falseunder[package]in your crate's Cargo.toml. - Is the error
failed to satisfy license requirementsfor a dependency? If so, first determine what license the project has and whether this system is sufficient to comply with this license's requirements. If you're unsure, ask a lawyer. Once you've verified that this system is acceptable add the license's SPDX identifier to theacceptedarray inscript/licenses/zed-licenses.toml. - Is
cargo-aboutunable to find the license for a dependency? If so, add a clarification field at the end ofscript/licenses/zed-licenses.toml, as specified in the cargo-about book.
Sponsorship
Zed is developed by Zed Industries, Inc., a for-profit company.
If you’d like to financially support the project, you can do so via GitHub Sponsors. Sponsorships go directly to Zed Industries and are used as general company revenue. There are no perks or entitlements associated with sponsorship.