altlist

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AltFilter

func AltFilter(term string, targets []string) []list.Rank

DefaultFilter uses the sahilm/fuzzy to filter through the list. This is set by default.

func KeyUsedByList

func KeyUsedByList(k list.KeyMap, msg tea.Msg) bool

func MakeSearchFunc

func MakeSearchFunc(option SearchOption) func(term string, targets []string) []list.Rank

Types

type DefaultItemDelegateAlt

type DefaultItemDelegateAlt struct {
	list.DefaultDelegate
	// contains filtered or unexported fields
}

func SelectableItemsDelegate

func SelectableItemsDelegate() DefaultItemDelegateAlt

func (DefaultItemDelegateAlt) Render

func (d DefaultItemDelegateAlt) Render(w io.Writer, m list.Model, index int, item list.Item)

type SearchList

type SearchList struct {
	List        list.Model
	SearchInput textinput.Model
	// contains filtered or unexported fields
}

func NewSearchList

func NewSearchList[T list.DefaultItem](items []T, config SearchListConfig, d list.ItemDelegate) SearchList

func (SearchList) GetMsgForParent

func (s SearchList) GetMsgForParent() (tea.Model, tea.Msg)

func (SearchList) HandleRecvFocus

func (s SearchList) HandleRecvFocus() (tea.Model, tea.Cmd)

func (SearchList) HandleSizeMsg

func (s SearchList) HandleSizeMsg(msg teapb.ResizeMsg) (tea.Model, tea.Cmd)

func (SearchList) Init

func (s SearchList) Init() tea.Cmd

func (*SearchList) SetMsgForParent

func (s *SearchList) SetMsgForParent(msg tea.Msg)

func (SearchList) Update

func (s SearchList) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (SearchList) View

func (s SearchList) View() string

type SearchListConfig

type SearchListConfig struct {
	Width         int
	Height        int
	MultiSelect   bool
	SortByMatches bool
}

type SearchOption

type SearchOption struct {
	CaseSensitive    bool
	MatchesOnly      bool // if true, only items with matches are returned
	SortByMatchCount bool // if true, ranks are sorted by match count
	ReverseSort      bool // if true, ranks are sorted in descending order
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL