Documentation
¶
Overview ¶
Package keybind is the name-indexed key-rebinding registry: a map of stable lower-case names to bubbles key.Binding pointers, with config-driven overrides and enumeration. The semantics are deliberate and shared by any app that adopts it: an empty override is ignored so a partial config never silently unbinds an action, the first override key becomes the help label while the description is kept, and an unknown name is an error rather than a silent no-op so a config typo surfaces. The package knows nothing about which bindings exist — the owner declares its own key map struct and hands in the pointers — so it lifts cleanly into any Bubble Tea app.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Registry ¶
Registry maps stable lower-case names to the owner's binding fields. Values are pointers so Rebind mutates the owner's key map in place; build the registry from the same struct the app reads bindings off.
func (Registry) Names ¶
Names returns every rebindable binding name, sorted. Useful for docs and for validating a config file's keybinding overrides.
func (Registry) Rebind ¶
Rebind applies user overrides keyed by binding name (e.g. {"transition": {"x"}}). An empty key slice is ignored so a partial config never silently unbinds an action. The first key becomes the help label; the description is kept. An unknown name is an error rather than a silent no-op, so a typo in a config file is surfaced — and it is checked before anything mutates, so a failed Rebind leaves every binding exactly as it was.