Skip to main content

Module keymap

Module keymap 

Source
Expand description

作用域感知快捷键与命令路由系统(Keymap / KeyStroke / KeyChord / ActionId,100% #![no_std] 零堆)。

对标 GPUI / VS Code 的声明式键盘命令派发模型:

  • 支持单键组合(如 Ctrl+S、Ctrl+Shift+P)与两段弦键(如 Ctrl+K, Ctrl+S);
  • 支持按焦点上下文栈(如 &["Editor", "Workspace", "Global"])自内向外精准匹配命令;
  • 弦键等待态内置自动超时复位,避免误按前缀键卡死后续输入。

Structs§

ActionId
强类型业务命令/动作 ID(例如 const SAVE: ActionId = ActionId(1);)。
KeyBinding
单条作用域快捷键绑定记录(context == None 表示全局兜底生效)。
KeyChord
单键或两段弦键快捷键序列(如 Ctrl+K 后接 Ctrl+S)。
KeyStroke
单个按键组合(键值 + 修饰键位掩码)。
Keymap
定长无堆作用域快捷键路由表与弦键状态机(默认最多 64 条绑定,支持 #![no_std])。

Enums§

KeymapMatch
快捷键解析结果。