class

TUI::KeyMenu

Inherits Reference < Object

An ordered registry of {trigger, label, action} bindings backing BOTH key dispatch and the status-bar hint describing those same bindings, so the two can't drift — #hint is generated from exactly the data #dispatch uses, gated by the same when: predicate. Deliberately excludes MouseClick: a click has no stable "label" and needs widget-specific coordinate math, which stays where it already lives (Window/SplitWindow).

Constructors

Instance methods

bind(trigger : Key | Char, label : String | -> String, when condition : -> Bool | Nil = nil, &action : KeyEvent -> _) : Nil

action receives the matched KeyEvent — ignore it ({ do_thing }) if the binding doesn't need it. Matching always consumes the event; a binding that wants to conditionally decline should use when:.

label is either a fixed String (the common case) or a -> String for a binding whose hint text itself depends on runtime state (e.g. "h:hide"/"h:show" toggling with what it would currently do) — re-evaluated on every #hint call, same as when:.

Source
dispatch(ev : KeyEvent) : Bool

Tries every active binding in registration order. Returns true (consumed) on the first match; false if nothing matched.

Source
hint

Ordered, space-joined hint text for every currently-active binding (when: true or absent) — same data + same gate as #dispatch, so dispatch and displayed hint can never drift apart.

Source

Nested types