Skip to content

feat: support SetHighlightedFunc for TextView region-based navigation #6

@cassdeckard

Description

@cassdeckard

Summary

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)
  • Consider related: feat: support SetInputCapture per primitive #13 (presentation navigation model)

Relevant Files

  • config/types.go – add onHighlighted to TextView/Primitive
  • builder/properties.goapplyTextViewProperties
  • template/ – executor support for region args
  • docs/tview-coverage.md – document once implemented

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions