Expand description
Keymap trie — prefix-indexed dispatcher from chord sequences to
PageAction.
Each binding is a path from root to a leaf; each node optionally
carries a PageAction of its own (so g can map to one action
while gg maps to another). Lookup walks the trie one chord at a
time and returns:
- [
Lookup::Match(action)] — exact action; the engine fires it and resets the pending buffer. Lookup::Pending— current chord sequence is a valid prefix of one or more bindings; engine starts the timeout clock.Lookup::NoMatch— sequence doesn’t lead anywhere; engine resets and may forward the chords to the page.
Ambiguity (g mapped and gg mapped) resolves the same way vim
does: caller tracks elapsed time since the first chord and, if
the configured timeout elapses without a longer match, fires the
shorter action. This module doesn’t own the clock —
crate::engine::Engine does.
§Mode scoping
A Keymap holds one trie per PageMode (Normal, Visual,
Command, Hint). Pending and Edit are not bindable directly:
Pending is a transient internal state of the engine, and Edit-mode
routes through feed_edit_mode_key instead of the trie.