listview

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package listview provides shared list navigation and scrolling logic for list-based UI components.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type State

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

State holds the navigation state for a list view.

func New

func New() *State

New creates a new list view state.

func (*State) Count

func (s *State) Count() int

Count returns the item count.

func (*State) Cursor

func (s *State) Cursor() int

Cursor returns the current cursor position.

func (*State) Focused

func (s *State) Focused() bool

Focused returns whether the list is focused.

func (*State) GoToBottom

func (s *State) GoToBottom()

GoToBottom moves the cursor to the last item.

func (*State) GoToTop

func (s *State) GoToTop()

GoToTop moves the cursor to the first item.

func (*State) Height

func (s *State) Height() int

Height returns the current height.

func (*State) MoveDown

func (s *State) MoveDown()

MoveDown moves the cursor down by one.

func (*State) MoveUp

func (s *State) MoveUp()

MoveUp moves the cursor up by one.

func (*State) Offset

func (s *State) Offset() int

Offset returns the current scroll offset.

func (*State) PageDown

func (s *State) PageDown()

PageDown moves the cursor down by one page.

func (*State) PageUp

func (s *State) PageUp()

PageUp moves the cursor up by one page.

func (*State) Scroll

func (s *State) Scroll(delta int)

Scroll scrolls the view by delta lines.

func (*State) SetCount

func (s *State) SetCount(count int)

SetCount updates the item count and adjusts cursor if needed.

func (*State) SetCursor

func (s *State) SetCursor(pos int)

SetCursor sets the cursor position.

func (*State) SetFocused

func (s *State) SetFocused(focused bool)

SetFocused sets the focus state.

func (*State) SetSize

func (s *State) SetSize(width, height int)

SetSize updates the dimensions.

func (*State) VisibleRows

func (s *State) VisibleRows() int

VisibleRows returns the number of visible rows.

func (*State) Width

func (s *State) Width() int

Width returns the current width.

Jump to

Keyboard shortcuts

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