item.go

 1package lazylist
 2
 3// Item represents a single item in the lazy-loaded list.
 4type Item interface {
 5	// Render returns the string representation of the item for the given
 6	// width.
 7	Render(width int) string
 8}
 9
10// Focusable represents an item that can gain or lose focus.
11type Focusable interface {
12	// Focus sets the focus state of the item.
13	Focus()
14
15	// Blur removes the focus state of the item.
16	Blur()
17
18	// Focused returns whether the item is focused.
19	Focused() bool
20}
21
22// Highlightable represents an item that can have a highlighted region.
23type Highlightable interface {
24	// SetHighlight sets the highlight region (startLine, startCol) to (endLine, endCol).
25	// Use -1 for all values to clear highlighting.
26	SetHighlight(startLine, startCol, endLine, endCol int)
27
28	// GetHighlight returns the current highlight region.
29	GetHighlight() (startLine, startCol, endLine, endCol int)
30}