preview

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
const HistoryLines = 2000

HistoryLines is how much scrollback a scroll-lock fetches.

Variables

This section is empty.

Functions

func Sanitize

func Sanitize(s string) string

Sanitize keeps the printable text and the SGR (colour and attribute) sequences of a captured line; every other escape or control (OSC, cursor movement, BEL, ...) is dropped, so a pane can never move the TUI's cursor or retitle its terminal.

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

func (m *Model) Cursor(w, h int) (x, y int, ok bool)

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) Follow

func (m *Model) Follow()

Follow leaves scroll-lock: live updates resume.

func (*Model) HScroll

func (m *Model) HScroll(n, w int)

HScroll moves the horizontal offset by n cells within a window of w cells.

func (*Model) Lock

func (m *Model) Lock(history tmux.PaneView, n, h int)

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

func (m *Model) Render(w, h int) []string

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

func (m *Model) ScrollBy(n, h int)

ScrollBy moves the scroll-lock view up (positive) by n lines within a window of h rows.

func (*Model) Set

func (m *Model) Set(v tmux.PaneView) bool

Set stores a live capture. It reports whether the content changed (an unchanged capture needs no re-render).

func (*Model) SetTarget

func (m *Model) SetTarget(t Target) bool

SetTarget points the preview at t; a new target drops the content.

type Target

type Target struct {
	RunID string
	Pane  string
}

Target is the pane a preview shows.

Jump to

Keyboard shortcuts

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