scrollinglist

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package scrollinglist provides a scrollalbe list bubbletea component

Index

Constants

This section is empty.

Variables

View Source
var DefaultFocusedStyle = lipgloss.NewStyle().
	Border(lipgloss.ThickBorder()).
	BorderForeground(lipgloss.Color("197")).
	BorderTop(false).BorderBottom(false).BorderRight(false).
	PaddingLeft(1).
	Foreground(lipgloss.Color("#EE6FF8"))
View Source
var DefaultUnfocusedStyle = lipgloss.NewStyle().
	Border(lipgloss.HiddenBorder()).
	BorderTop(false).BorderBottom(false).BorderRight(false).
	PaddingLeft(1).
	Foreground(lipgloss.Color("#C2B8C2"))

Functions

func PrefixSumBreak

func PrefixSumBreak(list []int, valueToReach int) (int, int)

Find an index such that 0 to index just (over)fills valueToReach i.e. the appropriate value - 1

func SuffixSumBreak

func SuffixSumBreak(list []int, valueToReach int) (int, int)

Find an index such that index to len(list) just (over)fills valueToReach i.e. the appropriate value + 1

Types

type KeyMap

type KeyMap struct {
	Down key.Binding
	Up   key.Binding

	GotoBottom key.Binding
	GotoTop    key.Binding

	Quit key.Binding

	ShowFullHelp  key.Binding
	CloseFullHelp key.Binding
}

func DefaultKeyMap

func DefaultKeyMap() KeyMap

type ScrollingList

type ScrollingList struct {
	Items   []fmt.Stringer
	Focused int

	UnfocusedStyle  lipgloss.Style
	FocusedStyle    lipgloss.Style
	ListAlignment   lipgloss.Position
	GlobalAlignment lipgloss.Position

	FirstVisible       int
	FirstPartial       int
	LastVisible        int
	LastPartial        int
	NumLinesFromBorder int

	Height int
	Width  int
	// contains filtered or unexported fields
}

func NewScrollingList

func NewScrollingList() ScrollingList

func (*ScrollingList) FooterView

func (sl *ScrollingList) FooterView() string

func (*ScrollingList) GotoBottom

func (sl *ScrollingList) GotoBottom()

func (*ScrollingList) GotoTop

func (sl *ScrollingList) GotoTop()

func (ScrollingList) Init

func (sl ScrollingList) Init() tea.Cmd

func (*ScrollingList) Next

func (sl *ScrollingList) Next()

func (*ScrollingList) Prev

func (sl *ScrollingList) Prev()

func (*ScrollingList) SetItems

func (sl *ScrollingList) SetItems(items []fmt.Stringer)

Replace all items

func (ScrollingList) Update

func (sl ScrollingList) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*ScrollingList) UpdateItem

func (sl *ScrollingList) UpdateItem(index int)

Updates/Replaces the item at one index

func (ScrollingList) View

func (sl ScrollingList) View() string

func (*ScrollingList) VisibleLines

func (sl *ScrollingList) VisibleLines() []string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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