beamtea_keybind (beamtea v0.1.2)
View SourceA bubble: key bindings (the key package in charmbracelet/bubbles).
A binding groups the concrete keys that trigger an action with the help text describing it, so your update/2 matches against intent rather than raw keys, and beamtea_help can render the controls automatically.
Up = beamtea_keybind:new([up, {char, $k}], {<<"↑/k">>, <<"up">>}),
case beamtea_keybind:matches(Key, Up) of true -> ...; false -> ... end
Summary
Functions
The {KeyLabel, Description} help pair.
Does Key trigger this binding? (Always false when disabled.)
Does Key match any binding in the list?
A binding over Keys with {KeyLabel, Description} help.
Types
Functions
The {KeyLabel, Description} help pair.
-spec keys(binding()) -> [beamtea_key:key()].
-spec matches(beamtea_key:key(), binding()) -> boolean().
Does Key trigger this binding? (Always false when disabled.)
-spec matches_any(beamtea_key:key(), [binding()]) -> boolean().
Does Key match any binding in the list?
-spec new([beamtea_key:key()], {iodata(), iodata()}) -> binding().
A binding over Keys with {KeyLabel, Description} help.
-spec new([beamtea_key:key()], {iodata(), iodata()}, boolean()) -> binding().