Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Add keymatch modes so terminal can have cmd-k (#4219)
Conrad Irwin61dfec2b75fb
diff --cc crates/gpui/src/key_dispatch.rsindex b4de09e36c5,59c75abd5ee..c6a2e178845--- a/crates/gpui/src/key_dispatch.rs+++ b/crates/gpui/src/key_dispatch.rs@@@ -57,11 -57,22 +57,21 @@@ use collections::FxHashMapuse smallvec::{smallvec, SmallVec};use std::{any::{Any, TypeId},+ cell::RefCell,mem,rc::Rc,- sync::Arc,};+ /// KeymatchMode controls how keybindings are resolved in the case of conflicting pending keystrokes.+ /// When `Sequenced`, gpui will wait for 1s for sequences to complete.+ /// When `Immediate`, gpui will immediately resolve the keybinding.+ #[derive(Default, PartialEq)]+ pub enum KeymatchMode {+ #[default]+ Sequenced,+ Immediate,+ }+#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]pub(crate) struct DispatchNodeId(usize);@@@ -72,8 -83,9 +82,9 @@@ pub(crate) struct DispatchTreefocusable_node_ids: FxHashMap<FocusId, DispatchNodeId>,view_node_ids: FxHashMap<EntityId, DispatchNodeId>,keystroke_matchers: FxHashMap<SmallVec<[KeyContext; 4]>, KeystrokeMatcher>,- keymap: Arc<Mutex<Keymap>>,+ keymap: Rc<RefCell<Keymap>>,action_registry: Rc<ActionRegistry>,+ pub(crate) keymatch_mode: KeymatchMode,}#[derive(Default)]