From 31ad658c13b9402b78915e5e4ad4630d53cc6f1f Mon Sep 17 00:00:00 2001 From: "gcp-cherry-pick-bot[bot]" <98988430+gcp-cherry-pick-bot[bot]@users.noreply.github.com> Date: Wed, 20 Nov 2024 15:38:22 -0700 Subject: [PATCH] Don't re-render the menu so often (cherry-pick #20914) (#20915) Cherry-picked Don't re-render the menu so often (#20914) Closes #20710 Release Notes: - Fixes opening the menu when Chinese Pinyin keyboard is in use Co-authored-by: Conrad Irwin --- crates/zed/src/zed.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index 0f10f1914bfd42e48aa74bd599a3586190cd56a5..867ffa91e686fe19b3c95812d04ecdd36fc20ff6 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -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();