Skip to main content

Module chord

Module chord 

Source
Expand description

Re-export shim for the chord primitives.

K.2.1 (2026-06-01) relocated the canonical definitions of KeyChord / KeyKind / KeyMods / SpecialKey / ChordPattern (and the chord parser / formatter) into lattice-protocol, so any crate at the dependency floor can construct chord values without depending on lattice-host. The host’s own keymap matcher (KeymapTrie / KeymapLayer / BoundCommand) still lives here; only the wire data moved.

This shim preserves the existing lattice_host::chord::{...} import paths used by the TUI / GPUI adapters and the host internals. Plan to retire the shim once downstream re-imports flip to lattice_protocol::chord::*.

Structs§

KeyChord
Canonical, stack-allocated representation of one chord.
KeyMods
Modifier bitfield. Copy + Eq + Hash so the whole KeyChord fits in a CPU register.

Enums§

ChordParseError
Parse-side error variants. Detail-level so :bind-style error messages can surface what was wrong.
ChordPattern
One element of a keymap registration path.
KeyKind
What kind of key the chord represents.
SpecialKey
Named special keys. Renderer-neutral; crossterm’s KeyCode::BackTab is normalised away by the TUI adapter (from_crossterm) into Special(Tab) + KeyMods::SHIFT so the trie has one entry for “shift-tab” rather than two ambiguous ones.

Functions§

last_chord_token_byte_len
Number of bytes the last chord token occupies at the end of text, treating it as a sequence of chord tokens (one chord per logical keypress). Used by chord-capture’s backspace handler to remove a whole token instead of a single char.
parse_chord_sequence
Parse a chord-sequence string into the canonical Vec<KeyChord> the keymap trie indexes by.
special_label
Canonical name for a SpecialKey. Round-trips through parse_special. Renderer-neutral text; both the TUI’s format_chord and any future GPUI describe-key renderer use this label.