Documentation
¶
Overview ¶
Package termpanes owns the host-independent state and lifecycle of Sidecar's live terminal leaves.
A Deck deliberately does not render or persist itself. Hosts own their pane trees and target policy; the deck only keys terminal state by tree leaf ID. Potentially expensive terminal operations are returned as tea.Cmd.
Index ¶
Constants ¶
const ( CapMessage = "Two live terminals at a time; close one first" CapDisabledReason = "Two terminals are already on screen — close one first" )
const SessionPrefix = "sidecar-tp-"
Variables ¶
This section is empty.
Functions ¶
func CloseNeedsConfirm ¶
CloseNeedsConfirm reports whether a split close must ask about a running process rather than closing its login shell directly.
func EnsureSession ¶
EnsureSession reuses a split session when it exists, otherwise creates it.
func KillSession ¶
KillSession ends only a session created for a terminal split.
func SessionName ¶
SessionName derives the stable tmux name used by a terminal split on every host. selector is the owning workspace or shell's durable tmux identity.
Types ¶
type CloseEvidence ¶
CloseEvidence is the minimum tmux state needed to decide whether a terminal split may close immediately or needs a running-process confirmation.
func ProbeClose ¶
func ProbeClose(session string) (CloseEvidence, error)
ProbeClose asks only the owned split session what is currently running.
type Deck ¶
type Deck struct {
// contains filtered or unexported fields
}
Deck is the keyed collection of live leaf state for one pane tree.
func (*Deck) LiveLeafCount ¶
func (d *Deck) LiveLeafCount(root *panelayout.Node) int
LiveLeafCount answers the cap from the pane tree, which remains the source of truth for which leaves are live.
type Leaf ¶
type Leaf struct {
ID int
// Requested is host reconciliation policy: the keyed state should have a
// live tree leaf. It is distinct from merely preparing detached state.
Requested bool
Terminal *tty.Model
Target Target
Buffer *tty.OutputBuffer
Scroll int
Freeze tty.WindowFreeze
FreezeDoc bool
History tty.HistoryReach
LinkState termpreview.LinkState
LinkContext any
RowAnalyzer *termpreview.RowAnalyzer
// Interaction state belongs to the leaf where the gesture or input mode
// began. HostState retains host-specific adapters without teaching this
// presentation-neutral collection either host's private interface.
Selection ui.SelectionState
Pointer tty.Pointer
Wheel tty.WheelBurst
Interactive bool
HostState any
Session string
PaneID string
Name string
}
Leaf is all mutable state belonging to one live terminal leaf.
func (*Leaf) Close ¶
func (l *Leaf) Close()
Close releases the model synchronously and clears its target.
func (*Leaf) ReadHistory ¶
ReadHistory performs a caller-supplied history read as a command. The deck owns the reach state while the host owns target resolution and result policy.
type Target ¶
type Target struct {
Session string
Pane string
// Host names the machine the session lives on; empty is this machine. It
// is stored rather than derived because the surface compares its stored
// target against a desired one to decide "am I already showing this?" —
// and a comparison that always dropped Host could never answer yes for a
// remote pane, so every poll tore down its ssh connection and reseeded.
Host string
Width int
Height int
Source string
SourceID string
}
Target is the currently attached terminal identity and geometry. Source and SourceID are host vocabulary used to distinguish projections of the same tmux target without coupling the deck to a particular surface.