Package-Level Type Names (total 2, both are exported)
/* sort exporteds by: | */
List holds a collection of items that can be displayed with an N number of
visible items. The list can be moved up, down by one item of time or an
entire page (ie: visible size). It keeps track of the current selected item.
SearcherSearcher
// cursor holds the index of the current selected item
items[]*interface{}scope[]*interface{}
// size is the number of visible options
startint
CanPageDown returns whether a list can still PageDown().
CanPageUp returns whether a list can still PageUp().
CancelSearch stops the current search and returns the list to its
original order.
Index returns the index of the item currently selected inside the searched list. If no item is selected,
the NotFound (-1) index is returned.
Items returns a slice equal to the size of the list with the current visible
items and the index of the active item in this list.
Next moves the visible list forward one item. If the selected item is out of
view, the new select item becomes the first visible item. If the list is
already at the bottom, nothing happens.
PageDown moves the visible list forward by x items. Where x is the size of
the visible items on the list. The selected item becomes the first visible
item.
PageUp moves the visible list backward by x items. Where x is the size of the
visible items on the list. The selected item becomes the first visible item.
If the list is already at the bottom, the selected item becomes the last
visible item.
Prev moves the visible list back one item. If the selected item is out of
view, the new select item becomes the last visible item. If the list is
already at the top, nothing happens.
Search allows the list to be filtered by a given term. The list must
implement the searcher function signature for this functionality to work.
SetCursor sets the position of the cursor in the list. Values out of bounds
will be clamped.
SetStart sets the current scroll position. Values out of bounds will be
clamped.
Start returns the current render start position of the list.
(*T) search(term string)
func New(items interface{}, size int) (*List, error)
Searcher is a base function signature that is used inside select when activating the search mode.
If defined, it is called on each items of the select and should return a boolean for whether or not
the item fits the searched term.
Package-Level Functions (only one, which is exported)
New creates and initializes a list of searchable items. The items attribute must be a slice type with a
size greater than 0. Error will be returned if those two conditions are not met.
Package-Level Constants (only one, which is exported)
NotFound is an index returned when no item was selected. This could
happen due to a search without results.
The pages are generated with Goldsv0.3.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.