Don't re-render the menu so often (#20914)

Closes #20710

Release Notes:

- Fixes opening the menu when Chinese Pinyin keyboard is in use
This commit is contained in:
Conrad Irwin 2024-11-20 10:27:50 -07:00 committed by GitHub
parent 41fd9189e3
commit 1475a7000f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -824,8 +824,13 @@ pub fn handle_keymap_file_changes(
})
.detach();
cx.on_keyboard_layout_change(move |_| {
keyboard_layout_tx.unbounded_send(()).ok();
let mut current_mapping = settings::get_key_equivalents(cx.keyboard_layout());
cx.on_keyboard_layout_change(move |cx| {
let next_mapping = settings::get_key_equivalents(cx.keyboard_layout());
if next_mapping != current_mapping {
current_mapping = next_mapping;
keyboard_layout_tx.unbounded_send(()).ok();
}
})
.detach();