Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

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

Conrad Irwin1475a7000f79
diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs
index 0f10f1914bf..867ffa91e68 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();