keymap_editor: Fix incorrect keystroke being reported (#36998)

This PR fixes two bugs and also changes one behavior in the **Keymap
Editor**.

As shown in the video, when I press `ctrl-shift-2` in the Keymap Editor,
the first keystroke is displayed as `ctrl-shift-@`, which is incorrect.
On macOS and Linux, it should be `ctrl-@`.



https://github.com/user-attachments/assets/69cfcfa0-b422-45d6-8e69-80f8608180fd



Also, after pressing `ctrl-shift-2` and then releasing `2` and `ctrl`, a
`shift` keystroke was incorrectly added.



https://github.com/user-attachments/assets/892124fd-847d-4fde-9b20-a27ba49ac934



Now, when you enter a sequence like `+ctrl+alt-alt+f` in the Keymap
Editor, it will output `ctrl-f` instead of `ctrl-alt-f`, matching VS
Code’s behavior.


Release Notes:

- Fixed incorrect keystroke reporting in the Keymap Editor.
This commit is contained in:
张小白
2025-08-28 15:16:13 +08:00
committed by GitHub
parent 78c2f1621d
commit 38e5c8fb66
2 changed files with 137 additions and 19 deletions
+7
View File
@@ -4578,6 +4578,13 @@ impl Window {
}
None
}
/// For testing: set the current modifier keys state.
/// This does not generate any events.
#[cfg(any(test, feature = "test-support"))]
pub fn set_modifiers(&mut self, modifiers: Modifiers) {
self.modifiers = modifiers;
}
}
// #[derive(Clone, Copy, Eq, PartialEq, Hash)]