Documentation
¶
Overview ¶
Package bounded provides pointer-owned, ANSI-aware bounded terminal controls.
Viewport offsets and List logical selection are independent. ViewportView is a contentless projection over lines supplied by its caller for each render; ListView contains ListRow metadata. Layout is measured in terminal display cells and invalid geometry produces an empty view. Item IDs must be unique and stable across refreshes: refreshes preserve the selected ID and top-visible semantic anchor; a missing selection adopts its clamped replacement and does not snap back. Lists configure one selection cell plus zero to two status cells. ListItem status cells are opaque one-display-cell markers; invalid, multi-cell, or multiline values are omitted before ListRow projects them. Callers own selected styling and hit regions. Controls are stateful and pointer-owned; they have no Bubble Tea, theme, or Mecatl domain dependency.
Index ¶
- type List
- func (l *List) Cursor() int
- func (l *List) CursorID() string
- func (l *List) Height() int
- func (l *List) Move(move Move)
- func (l *List) Offset() int
- func (l *List) RevealPending() bool
- func (l *List) Scroll(move Move)
- func (l *List) SetCursor(index int)
- func (l *List) SetGeometry(width, height, gutterCells int, policy Policy)
- func (l *List) SetItems(items []ListItem)
- func (l *List) Valid() bool
- func (l *List) View() ListView
- func (l *List) ViewWithIndicators(capacity int, reveal bool) ListView
- type ListItem
- type ListRow
- type ListView
- type Move
- type Policy
- type Viewport
- func (v *Viewport) Clamp(total int)
- func (v *Viewport) Height() int
- func (v *Viewport) Move(move Move, total int)
- func (v *Viewport) Offset() int
- func (v *Viewport) Reset()
- func (v *Viewport) SetGeometry(width, height, gutter int, policy Policy)
- func (v *Viewport) SetOffset(offset, total int)
- func (v *Viewport) Valid() bool
- func (v *Viewport) View(lines []string) ViewportView
- type ViewportView
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type List ¶
type List struct {
// contains filtered or unexported fields
}
List manages selectable items in a bounded viewport.
func (*List) RevealPending ¶
RevealPending reports whether the cursor should be brought into view.
func (*List) SetGeometry ¶
SetGeometry configures the list viewport dimensions, gutter-cell count, and fitting policy. Every list has one selection cell and zero to two status cells; a trailing padding cell separates that gutter from content.
func (*List) SetItems ¶
SetItems replaces the list contents while preserving compatible viewport anchors.
func (*List) ViewWithIndicators ¶
ViewWithIndicators applies the shared logical-item indicator policy. Indicators report only complete items outside the physical window; partial oversized-item segments remain reachable through normal paging rather than becoming overflow.
type ListItem ¶
ListItem is an entry rendered by a List. StatusCells are optional one-display-cell markers for the two cells after the selection cell; invalid markers are omitted.
type ListRow ¶
type ListRow struct {
Text, ID string
ItemIndex, ItemLine int
Selected, CursorMarker bool
StatusCells [2]string
GutterCells int
}
ListRow is one rendered line in a ListView. StatusCells and GutterCells are presentation metadata: the caller renders their cells. GutterCells is always in [1, 3], and StatusCells contain only valid one-display-cell markers.
type Viewport ¶
type Viewport struct {
// contains filtered or unexported fields
}
Viewport tracks the visible window over caller-provided laid-out lines.
func (*Viewport) Clamp ¶
Clamp constrains the current offset to the configured geometry and content size.
func (*Viewport) SetGeometry ¶
SetGeometry configures the viewport dimensions and fitting policy.
func (*Viewport) SetOffset ¶ added in v0.0.45
SetOffset positions the viewport at a physical row, clamped to its content.
func (*Viewport) View ¶
func (v *Viewport) View(lines []string) ViewportView
View returns the bounded projection of lines. Callers provide lines for each render.
type ViewportView ¶
ViewportView is the bounded projection of caller-provided lines.