Skip to main content

Module keybinding_recorder

Module keybinding_recorder 

Source
Expand description

A field that captures the next keystroke instead of acting on it.

§The syntax it produces

The recorder reports GPUI’s own keystroke syntax, not a private one: it hands back gpui::Keystroke::unparse, which is exactly what gpui::Keystroke::parse reads. A captured binding therefore goes straight into a keymap, and straight into Kbd, which splits the same string. The shape is [fn-][ctrl-][alt-][cmd-|super-|win-][shift-]key, where key is the lowercase name of the key — cmd-shift-p, ctrl-alt-delete, f5.

§Escape

Escape ends recording without capturing. That is the honest limit: escape is how every other surface in this library abandons something in flight, and a recorder that swallowed it would leave the typist with no way out of a field that eats every key. The cost is that escape cannot be bound through the default recorder. A caller that genuinely needs it turns KeybindingRecorder::allow_escape on and provides its own way out.

§What it does not do

  • A modifier on its own is not a keystroke. The recorder keeps waiting rather than reporting shift as a binding.
  • A captured binding is reported, never applied. The caller owns the keymap, as it owns every other value in this library.
  • A conflict is the host’s judgement. The recorder has no keymap to consult and never guesses; KeybindingRecorder::conflict renders the reason the host found, and nothing else.

Structs§

KeybindingRecorder
A field that records one keystroke.

Enums§

KeybindingRecorderEvent
What a KeybindingRecorder reports.

Functions§

is_modifier
Whether a key name is a modifier rather than a key.