Documentation ¶
Index ¶
- type Finder
- func (f *Finder) Draw(screen tcell.Screen)
- func (f *Finder) GetCurrentItem() int
- func (f *Finder) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))
- func (f *Finder) SetChangedFunc(handler func(index int)) *Finder
- func (f *Finder) SetCounterStyle(style tcell.Style) *Finder
- func (f *Finder) SetCurrentItem(index int) *Finder
- func (f *Finder) SetDoneFunc(handler func(index int)) *Finder
- func (f *Finder) SetFieldStyle(style tcell.Style) *Finder
- func (f *Finder) SetHighlightFullLine(highlight bool) *Finder
- func (f *Finder) SetHighlightMatchMaintainBackgroundColor(maintainBackgroundColor bool) *Finder
- func (f *Finder) SetHighlightMatchStyle(style tcell.Style) *Finder
- func (f *Finder) SetInputLabel(inputLabel string) *Finder
- func (f *Finder) SetInputLabelStyle(style tcell.Style) *Finder
- func (f *Finder) SetInputPadding(padding int) *Finder
- func (f *Finder) SetItemLabel(label string) *Finder
- func (f *Finder) SetItemLabelPadding(itemLabelPadding int) *Finder
- func (f *Finder) SetItemLabelStyle(style tcell.Style) *Finder
- func (f *Finder) SetItemStyle(style tcell.Style) *Finder
- func (f *Finder) SetItems(itemCount int, provider ItemNameProviderFunction) *Finder
- func (f *Finder) SetMatcherFunc(matcher MatcherFunction) *Finder
- func (f *Finder) SetPlaceholder(placeholder string) *Finder
- func (f *Finder) SetPlaceholderStyle(style tcell.Style) *Finder
- func (f *Finder) SetSelectedFocusOnly(focusOnly bool) *Finder
- func (f *Finder) SetSelectedItemLabel(label string) *Finder
- func (f *Finder) SetSelectedItemLabelPadding(padding int) *Finder
- func (f *Finder) SetSelectedItemLabelStyle(style tcell.Style) *Finder
- func (f *Finder) SetSelectedItemStyle(style tcell.Style) *Finder
- func (f *Finder) SetWrapAround(wrapAround bool) *Finder
- type ItemNameProviderFunction
- type MatcherFunction
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Finder ¶
func (*Finder) Draw ¶
func (f *Finder) Draw(screen tcell.Screen)
Draw draws this primitive onto the screen.
func (*Finder) GetCurrentItem ¶
GetCurrentItem returns the index of the currently selected finder item, starting at 0 for the first item. Returns -1 if no item is selected (this only occurs when the list is empty).
func (*Finder) InputHandler ¶
InputHandler returns the handler for this primitive.
func (*Finder) SetChangedFunc ¶
SetChangedFunc sets the function which is called when the user navigates to an item. The function receives the item's index in the list of items (starting with 0, -1 when no item is selected).
func (*Finder) SetCounterStyle ¶
SetCounterStyle sets the style of the counter.
func (*Finder) SetCurrentItem ¶
SetCurrentItem sets the currently selected item by its index, starting at 0 for the first item. If a negative index is provided, items are referred to from the back (-1 = last item, -2 = second-to-last item, and so on). Out of range indices are clamped to the beginning/end.
Calling this function triggers a "changed" event if the selection changes.
func (*Finder) SetDoneFunc ¶
SetDoneFunc sets a handler which is called when the user is done entering text. The callback function is provided with the index of the most recently selected item. The index is -1 when no item was selected.
func (*Finder) SetFieldStyle ¶
SetFieldStyle sets the style of the input area (when no placeholder is shown).
func (*Finder) SetHighlightFullLine ¶
SetHighlightFullLine sets a flag which determines whether the colored background of selected items spans the entire width of the view. If set to true, the highlight spans the entire view. If set to false, only the text of the selected item from beginning to end is highlighted.
func (*Finder) SetHighlightMatchMaintainBackgroundColor ¶
SetHighlightMatchMaintainBackgroundColor defines whether the background color of highlightMatchStyle will be applied. If set to true, the background color of itemStyle or selectedItemStyle will be maintained. If false, the background color of highlightMatchStyle will be applied.
func (*Finder) SetHighlightMatchStyle ¶
SetHighlightMatchStyle sets the style used to highlight matches between items and the filter text.
func (*Finder) SetInputLabel ¶
SetInputLabel sets the text to be displayed before the input area.
func (*Finder) SetInputLabelStyle ¶
SetInputLabelStyle sets the style of the input label.
func (*Finder) SetInputPadding ¶
SetInputPadding sets the right padding of the inputLabel (space between label and input field).
func (*Finder) SetItemLabel ¶
SetItemLabel sets the text to be displayed before an item which is not selected.
func (*Finder) SetItemLabelPadding ¶
SetItemLabelPadding sets the right padding of the itemLabel (space between label and item text).
func (*Finder) SetItemLabelStyle ¶
SetItemLabelStyle sets the style of the label to be displayed before a (not selected) item.
func (*Finder) SetItemStyle ¶
SetItemStyle sets the style of a list item when not selected.
func (*Finder) SetItems ¶
func (f *Finder) SetItems(itemCount int, provider ItemNameProviderFunction) *Finder
SetItems sets the available number of items and a function to provide a name of a specific item by index.
func (*Finder) SetMatcherFunc ¶
func (f *Finder) SetMatcherFunc(matcher MatcherFunction) *Finder
SetMatcherFunc sets the function which is called in order to match the filter string with all available items.
func (*Finder) SetPlaceholder ¶
SetPlaceholder sets the text to be displayed when the input text is empty.
func (*Finder) SetPlaceholderStyle ¶
SetPlaceholderStyle sets the style of the input area (when a placeholder is shown).
func (*Finder) SetSelectedFocusOnly ¶
SetSelectedFocusOnly sets a flag which determines when the currently selected finder item is highlighted. If set to true, selected items are only highlighted when the finder has focus. If set to false, they are always highlighted.
func (*Finder) SetSelectedItemLabel ¶
SetSelectedItemLabel sets the text to be displayed before the currently selected item.
func (*Finder) SetSelectedItemLabelPadding ¶
SetSelectedItemLabelPadding sets the right padding of the selectedItemLabel (space between label and item text).
func (*Finder) SetSelectedItemLabelStyle ¶
SetSelectedItemLabelStyle sets the style of the label to be displayed before a selected item.
func (*Finder) SetSelectedItemStyle ¶
SetSelectedItemStyle sets the style of a list item when selected.
func (*Finder) SetWrapAround ¶
SetWrapAround sets the flag that determines whether navigating the finder list will wrap around. That is, navigating downwards on the last item will move the selection to the first item (similarly in the other direction). If set to false, the selection won't change when navigating downwards on the last item or navigating upwards on the first item.
type ItemNameProviderFunction ¶
ItemNameProviderFunction is called in order to retrieve the name of the item at the passed index. The string value returned from this function will be displayed in the finder list.
type MatcherFunction ¶
MatcherFunction is called in order to check if parts of an item cam be matched to the passed filter string. It returns a slice of all successive matches, the sore to sort items according to their similarity and a boolean value indicating if there was a match at all. [2]int represents the start position (inclusive) and end position (exclusive) within the item string.