rivo / tview

Terminal UI library with rich, interactive widgets — written in Golang

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request: generalize list items

voodookiidoo opened this issue · comments

commented

Currently, tview.List is based around text and secondary text.
But if you need to store a list of items and keep their representation valid - you have to keep a list of some items somewhere else, and keep track of their order. What about adding a CustomList (call it how you want), where instead of using plain text for items, use an interface like

type interface ListItem {
GetText() string
GetSecondaryText() string
GetRune() rune
GetSelectionFunction() func()
}

That would make maintaining both data and it's view much easier!
(I implemented it in my fork of your lib, can show you if you'd like to)