Source File
listbox_state.go
Belonging Package
src.elv.sh/pkg/cli/tk
package tkimport ()// ListBoxState keeps the mutable state ListBox.type ListBoxState struct {Items ItemsSelected intFirst intHeight int}// Items is an interface for accessing multiple items.type Items interface {// Show renders the item at the given zero-based index.Show(i int) ui.Text// Len returns the number of items.Len() int}// TestItems is an implementation of Items useful for testing.type TestItems struct {Prefix stringStyle ui.StylingNItems int}// Show returns a plain text consisting of the prefix and i. If the prefix is// empty, it defaults to "item ".func ( TestItems) ( int) ui.Text {:= .Prefixif == "" {= "item "}return ui.T(fmt.Sprintf("%s%d", , ), .Style)}// Len returns it.NItems.func ( TestItems) () int {return .NItems}
The pages are generated with Golds v0.2.8-preview. (GOOS=darwin GOARCH=arm64)