list

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 30, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ForceFocusUpdate

func ForceFocusUpdate() tea.Msg

ForceFocusUpdate will force to update and refocus the already focused item. It will call the registeredItemHandler of the list.

Types

type BottomNoMoreFocusableItems

type BottomNoMoreFocusableItems struct{}

type Content

type Content struct {
	Model
}

Content is a wrapper to use the filelist ui as container.Content.

func NewContent

func NewContent(model Model) Content

func (Content) SetSize

func (c Content) SetSize(width, height int) container.Content

func (Content) Update

func (c Content) Update(msg tea.Msg) (container.Content, tea.Cmd)

func (Content) UpdateFocus

func (c Content) UpdateFocus(isFocused bool) (container.Content, tea.Cmd)

type DeleteItemMsg

type DeleteItemMsg struct {
	Item Item
}

DeleteItemMsg indicates the intent to delete an item in the list. The item has not been removed from the list yet. We can return an appropiate tea.Cmd from the itemHandler to actually remove the data and update the views.

type EditItemMsg added in v0.2.0

type EditItemMsg struct {
	Item Item
}

EditItemMsg is an intent to edit an item.

type FocusItemMsg

type FocusItemMsg struct {
	Item Item
}

FocusItemMsg indicates the currently focued item in the list.

type Item

type Item interface {
	Render() string
}

type ItemHandler

type ItemHandler func(msg tea.Msg) tea.Cmd

type KeyMap

type KeyMap struct {
	Up     key.Binding
	Down   key.Binding
	Enter  key.Binding
	All    key.Binding
	Edit   key.Binding
	Delete key.Binding
}

func NewKeyMap

func NewKeyMap(allText string, enterHelpText string, deleteHelpText string) KeyMap

func (KeyMap) FullHelp

func (km KeyMap) FullHelp() [][]key.Binding

func (KeyMap) ShortHelp

func (km KeyMap) ShortHelp() []key.Binding

type Model

type Model struct {
	// contains filtered or unexported fields
}

func New

func New(title string, itemHandler ItemHandler, keys KeyMap) Model

func (Model) FocusedItem

func (m Model) FocusedItem() (Item, error)

func (Model) Init

func (m Model) Init() tea.Cmd

func (Model) IsFirstIndexFocused

func (m Model) IsFirstIndexFocused() bool

func (Model) IsLastIndexFocused

func (m Model) IsLastIndexFocused() bool

func (Model) KeyMap

func (m Model) KeyMap() help.KeyMap

func (Model) SetItems

func (m Model) SetItems(items []Item) (Model, tea.Cmd)

func (Model) SetSize

func (m Model) SetSize(width, height int) Model

func (Model) Title

func (m Model) Title() string

func (Model) Update

func (m Model) Update(msg tea.Msg) (Model, tea.Cmd)

func (Model) UpdateFocus

func (m Model) UpdateFocus(isFocused bool) (Model, tea.Cmd)

func (Model) View

func (m Model) View() string

type NoItemsMsg

type NoItemsMsg struct{}

type SelectAllItemMsg

type SelectAllItemMsg struct {
	Items []Item
}

SelectAllItemMsg produced when all items in a list were selected.

type SelectItemMsg

type SelectItemMsg struct {
	Item Item
}

SelectItemMsg indicates the selected item in the list. It is produced after `enter` key trigger.

type TopNoMoreFocusableItems

type TopNoMoreFocusableItems struct{}

type TopNoMoreItems

type TopNoMoreItems struct{}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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