You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add support for SetHighlightedFunc on TextView so a callback runs when the highlighted region changes. This enables region-based navigation (e.g. switching pages when the user selects a different region).
Background
Discovered while planning a tview presentation demo implementation via tviewyaml. The presentation info bar uses a TextView with regions for each slide; when the highlighted region changes, the app calls SwitchToPage to show that slide.
Demo Usage
Info bar needs to call SwitchToPage(highlightedRegion) when region changes.
Proposed Approach
Add onHighlighted (template expression) to TextView primitive config
In builder/properties.go, call SetHighlightedFunc when onHighlighted is set
Pass added/removed/remaining region IDs to the template (via state or function args)
Summary
Add support for
SetHighlightedFuncon TextView so a callback runs when the highlighted region changes. This enables region-based navigation (e.g. switching pages when the user selects a different region).Background
Discovered while planning a tview presentation demo implementation via tviewyaml. The presentation info bar uses a TextView with regions for each slide; when the highlighted region changes, the app calls
SwitchToPageto show that slide.Demo Usage
Info bar needs to call
SwitchToPage(highlightedRegion)when region changes.Proposed Approach
onHighlighted(template expression) to TextView primitive configbuilder/properties.go, callSetHighlightedFuncwhenonHighlightedis setRelevant Files
config/types.go– addonHighlightedto TextView/Primitivebuilder/properties.go–applyTextViewPropertiestemplate/– executor support for region argsdocs/tview-coverage.md– document once implemented