Add KeyContextView (#19872)
Release Notes: - Added `cmd-shift-p debug: Open Key Context View` to help debug custom key bindings https://github.com/user-attachments/assets/de273c97-5b27-45aa-9ff1-f943b0ed7dfe
This commit is contained in:
parent
cf7b0c8971
commit
ce5222f1df
12 changed files with 390 additions and 8 deletions
|
@ -75,6 +75,18 @@ impl Keymap {
|
|||
.filter(move |binding| binding.action().partial_eq(action))
|
||||
}
|
||||
|
||||
/// all bindings for input returns all bindings that might match the input
|
||||
/// (without checking context)
|
||||
pub fn all_bindings_for_input(&self, input: &[Keystroke]) -> Vec<KeyBinding> {
|
||||
self.bindings()
|
||||
.rev()
|
||||
.filter_map(|binding| {
|
||||
binding.match_keystrokes(input).filter(|pending| !pending)?;
|
||||
Some(binding.clone())
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// bindings_for_input returns a list of bindings that match the given input,
|
||||
/// and a boolean indicating whether or not more bindings might match if
|
||||
/// the input was longer.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue