Summary
Add support for SetInputCapture on individual primitives via an onInputCapture template expression, so primitives can handle keys before global key bindings. tviewyaml currently only has globalKeyBindings at the application level.
Background
Discovered while planning a tview presentation demo implementation via tviewyaml. The Flex and Grid slides use SetInputCapture on the main primitive to show a modal on first keypress, then advance slide on second keypress.
Demo Usage
Flex and Grid use SetInputCapture for custom keys; tviewyaml only has globalKeyBindings.
Proposed Approach
- Add
onInputCapture (template expression) to Primitive config; expression receives key event info, returns whether to consume event
- In builder, call
primitive.SetInputCapture(...) with a handler that evaluates the template
- Ordering: primitive capture runs before app-level capture; document interaction with globalKeyBindings
Relevant Files
config/types.go – add onInputCapture
builder/properties.go or builder/callbacks.go – attach SetInputCapture
template/ – key event helpers for template
docs/tview-coverage.md – document once implemented
Summary
Add support for
SetInputCaptureon individual primitives via anonInputCapturetemplate expression, so primitives can handle keys before global key bindings. tviewyaml currently only hasglobalKeyBindingsat the application level.Background
Discovered while planning a tview presentation demo implementation via tviewyaml. The Flex and Grid slides use
SetInputCaptureon the main primitive to show a modal on first keypress, then advance slide on second keypress.Demo Usage
Flex and Grid use SetInputCapture for custom keys; tviewyaml only has globalKeyBindings.
Proposed Approach
onInputCapture(template expression) to Primitive config; expression receives key event info, returns whether to consume eventprimitive.SetInputCapture(...)with a handler that evaluates the templateRelevant Files
config/types.go– addonInputCapturebuilder/properties.goorbuilder/callbacks.go– attach SetInputCapturetemplate/– key event helpers for templatedocs/tview-coverage.md– document once implemented