# gpui: Hide disabled bindings from the which-key popup \(\#64935\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/71456c40f3971ee763e620a513c5fb98390d93e3)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 71456c40f3971ee763e620a513c5fb98390d93e3

Requested commit: 71456c40f3971ee763e620a513c5fb98390d93e3

Commit: 71456c40f3971ee763e620a513c5fb98390d93e3

Tree: df8cd3714ea8038f83ce54b9d70bea4bfb758138

Author: Smit Barmase

Committer: GitHub

## Message

````
gpui: Hide disabled bindings from the which-key popup (#64935)

The which-key popup and the pending keystrokes indicator listed every
binding that starts with the pending keys, including ones disabled with
`null` or `zed::Unbind`:

```json
"cmd-k p": "editor::CopyPath",
"cmd-k p": null               // user keymap: CopyPath still showed as `p` after `cmd-k`
```

Key dispatch doesn't change. `Keymap::possible_next_bindings_for_input`
now checks what dispatch would run for each binding's full keystrokes,
and hides the binding if it isn't one of them. That applies the same
rules dispatch uses: a `null` in the `Workspace` context doesn't hide an
`Editor` binding, and a `null` in a base keymap doesn't hide your own
user bindings.

The check calls `resolve_bindings_for_input`. That's the existing body
of `bindings_for_input`, moved out so it can run over a list of bindings
the caller passes in. The popup uses the same code as dispatch, so the
two can't drift apart. It passes only the bindings that extend the typed
keys, not the whole keymap, so each check stays cheap.

Release Notes:

- Fixed the which-key popup and pending keystrokes indicator showing
keybindings that were disabled with `null` or `zed::Unbind`.
- [GPUI] Fixed `possible_bindings_for_input` returning bindings disabled
with `null` or `zed::Unbind`.
````

## Parents

- [74c134a3c12418cc095122fff938ef1c2504ae06](https://git.cafe/gitcafe/zed/commit/74c134a3c12418cc095122fff938ef1c2504ae06?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/71456c40f3971ee763e620a513c5fb98390d93e3?format=markdown)
