wip: refactoring tui
This commit is contained in:
parent
ca0ea3f94d
commit
653965ef59
14 changed files with 491 additions and 1391 deletions
|
|
@ -20,6 +20,7 @@ type SimpleList[T SimpleListItem] interface {
|
|||
GetSelectedItem() (item T, idx int)
|
||||
SetItems(items []T)
|
||||
GetItems() []T
|
||||
SetSelectedIndex(idx int)
|
||||
}
|
||||
|
||||
type simpleListComponent[T SimpleListItem] struct {
|
||||
|
|
@ -109,6 +110,12 @@ func (c *simpleListComponent[T]) SetMaxWidth(width int) {
|
|||
c.maxWidth = width
|
||||
}
|
||||
|
||||
func (c *simpleListComponent[T]) SetSelectedIndex(idx int) {
|
||||
if idx >= 0 && idx < len(c.items) {
|
||||
c.selectedIdx = idx
|
||||
}
|
||||
}
|
||||
|
||||
func (c *simpleListComponent[T]) View() string {
|
||||
t := theme.CurrentTheme()
|
||||
baseStyle := styles.BaseStyle()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue