Prefer later bindings in keymap section for display in UI (#23378)

Closes #23015

Release Notes:

- Improved which keybindings are selected for display. Now later entries
within `bindings` will take precedence. The default keymaps have been
updated accordingly.
This commit is contained in:
Michael Sloan 2025-01-20 16:20:15 -07:00 committed by GitHub
parent 919703e6a8
commit aacd80ee4a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 186 additions and 196 deletions

View file

@ -32,8 +32,9 @@ impl PreprocessorContext {
_ => return None,
};
keymap.sections().find_map(|section| {
section.bindings().find_map(|(keystroke, a)| {
// Find the binding in reverse order, as the last binding takes precedence.
keymap.sections().rev().find_map(|section| {
section.bindings().rev().find_map(|(keystroke, a)| {
if a.to_string() == action {
Some(keystroke.to_string())
} else {