Documentation
¶
Overview ¶
Package preview holds the TUI's view of one agent pane: the last capture, sanitized to text and SGR colours, cropped to the preview's size, with a live (follow) mode and a scroll-locked history mode.
Index ¶
- Constants
- func Sanitize(s string) string
- type Model
- func (m *Model) Cursor(w, h int) (x, y int, ok bool)
- func (m *Model) Follow()
- func (m *Model) HScroll(n, w int)
- func (m *Model) Lock(history tmux.PaneView, n, h int)
- func (m *Model) Render(w, h int) []string
- func (m *Model) ScrollBy(n, h int)
- func (m *Model) Set(v tmux.PaneView) bool
- func (m *Model) SetTarget(t Target) bool
- type Target
Constants ¶
const HistoryLines = 2000
HistoryLines is how much scrollback a scroll-lock fetches.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Model ¶
type Model struct {
Target Target
View tmux.PaneView
Lines []string // sanitized screen rows of the last live capture
Have bool // a capture of Target arrived
Err string
// Scroll-lock: Locked freezes the content at History (scrollback + the screen at
// that moment); Scroll counts lines up from the bottom.
Locked bool
History []string
Scroll int
XOff int
// contains filtered or unexported fields
}
Model is the preview state. The scheduling of captures (rate, one in flight) lives in the TUI's root model; this one only holds and renders content.
func (*Model) Cursor ¶
Cursor is where the pane's cursor sits in Render(w, h) (column, row), when the live view shows it: the application shows it (cursor_flag) and it is not cropped out.
func (*Model) Lock ¶
Lock enters scroll-lock with the fetched scrollback (the current screen follows it) and scrolls up n lines in a window of h rows.
func (*Model) Render ¶
Render returns the preview body for w x h cells, cropped at XOff: the scroll-lock window, or the bottom h rows of the screen's used part (down to its last text or the cursor, whichever is lower), since agents keep their input at the bottom.
func (*Model) ScrollBy ¶
ScrollBy moves the scroll-lock view up (positive) by n lines within a window of h rows.