Expand description
Vim-style leader key bar — generic, reusable across apps.
§Usage
- Define your menu tree as a
&'static [LeaderNode]. - Create
LeaderState::new(root). - Call
arm()when the leader key is pressed. - On each key: call
push(c)→LeaderResult. - Call
tick()each event-loop iteration (handles timeout). - Call
render_leader_bar(f, &state, screen_area, &theme)in your draw fn.
§Label rendering
Each LeaderNode takes a full label string (e.g. "navigate", "find").
The key character is highlighted inline with [k] brackets if it appears in
the label, otherwise it is displayed as a prefix:
[f]ind ← 'f' found at position 0
e[x]ecute ← 'x' found at position 1
[g] navigate ← 'g' not in "navigate"Structs§
- Leader
Node - One entry in a leader menu level.
- Leader
State
Enums§
- Leader
Result - Outcome of pressing a key while the leader is active.
Constants§
- POPUP_
DELAY - Delay before the leader popup first appears after arming. Fast typists never see a flash; once the popup is shown, subsequent keystrokes don’t re-trigger the delay.
Functions§
- render_
leader_ bar - Render the leader bar as a centered column popup.
Does nothing when
state.activeis false.