Documentation
¶
Overview ¶
Package panelayout owns the presentation-neutral pane tree shared by project and global workspace previews. It knows structure, geometry, and the default placement policy, but nothing about terminals, documents, issues, rendering, or persistence.
Index ¶
- Constants
- Variables
- func AtRingEnd(ring []Target, current Target, reverse bool) bool
- func ClampRatio(ratio int) int
- func Duplicable(kind Kind) bool
- func IsLive(kind Kind) bool
- func LayoutPanes(root *Node, box Box, floors Floors) (leaves []Placement, dividers []Divider, fits bool)
- func LeafCount(node *Node) int
- func LiveCapReached(root *Node) bool
- func LiveLeafCount(node *Node) int
- func MaxID(node *Node) int
- func SetRatio(root *Node, splitID, ratio int) bool
- type Axis
- type Box
- type Divider
- type Floor
- type Floors
- type Kind
- type Layout
- type Node
- func Clone(node *Node) *Node
- func Close(root *Node, leafID int) (*Node, int)
- func Find(root *Node, id int) *Node
- func FirstOfContent(node *Node, kind Kind, contentID int) *Node
- func FirstOfKind(node *Node, kind Kind) *Node
- func SplitLeaf(root *Node, leafID int, axis Axis, newLeaf *Node) (*Node, int)
- type OpenPlan
- type Placement
- type Split
- type Target
- type TargetKind
Constants ¶
const LiveLeafCap = 2
LiveLeafCap is how many live leaves may be on screen in one tree at once: the host's primary terminal plus one peer. Live leaves cost a control-mode subscription and a tmux resize per geometry change, so the cap is a refusal the caller reports, never a silent drop.
const Terminal = Primary
Terminal is the persisted-value and source compatibility alias used by the existing Workspace hosts. Primary deliberately retains its numeric value.
Variables ¶
var ContentPaneTarget = Target{Kind: TargetLeaf}
ContentPaneTarget names the single content window of a surface that has no pane tree — git's diff pane, the file browser's preview, the conversation message list, the notes editor. Those surfaces have one list and one content pane and nothing to give a leaf an id, so they all share this entry.
Functions ¶
func AtRingEnd ¶ added in v1.2.0
AtRingEnd reports that current is the last stop of the ring in the direction a cycle is about to move: the final entry going forward, the first one going back. It is the question a shell-owned stop has to ask before it can join a surface's Tab cycle — the notification centre uses it to insert itself between a surface's last window and its first, without either side growing a second cycle. A current target the ring does not contain is not at the end: the cycle has not started yet.
func ClampRatio ¶
func Duplicable ¶ added in v1.3.0
Duplicable reports that a second leaf of this kind is a second thing, not the same thing shown again. Document/Issue/Diff/Resource/Note swap their content in place, so opening one twice retargets the leaf that exists; a Shell open is a new session, so it always splits.
func IsLive ¶ added in v1.3.0
IsLive reports that a leaf of this kind drives a live terminal session.
func LayoutPanes ¶
func LeafCount ¶ added in v1.3.0
LeafCount is how many content leaves the tree holds. It is the number a sidebar row's layout badge is derived from, so a live tree and the tree the same workspace persisted are counted by one rule.
func LiveCapReached ¶ added in v1.3.0
LiveCapReached reports that no further live leaf fits in this tree. Hosts use it to explain the refusal instead of leaving PlanOpen's false unexplained.
func LiveLeafCount ¶ added in v1.3.0
LiveLeafCount is how many live leaves the tree currently holds.
Types ¶
type Box ¶
type Box = termpreview.Box
type Kind ¶
type Kind int
const ( // Primary is the host's owned content. In Workspaces that content is a // terminal; app content decks may host any plugin without changing the pane // tree's persisted vocabulary. Primary Kind = iota Document Issue Diff // Resource is the single leaf kind every external terminal resource // provider shares. The extension point is which resource is recognized // and resolved, not which windows exist, so a Jira ticket and a CI build // become tabs in one leaf rather than two pane kinds. Resource // Shell is a live terminal leaf the user created, distinct from Primary: // Primary is the one terminal the host owns, Shell is a peer session the // tree hosts beside it. Keeping them apart is what lets a host have more // than one live terminal without the tree learning what a terminal is. Shell // Note is a read-only td note card. Added after Shell so existing numeric // Kind values stay stable; persistence uses the string "note". Note )
type Node ¶
func Clone ¶
Clone returns a detached copy suitable for trial layout before committing a split that may not fit the current viewport.
func FirstOfContent ¶ added in v1.3.0
FirstOfContent names the leaf already showing one content id of a kind, or nil. A live session is never shown in two leaves, so an open that names a session already on screen retargets it rather than splitting.
func FirstOfKind ¶
type OpenPlan ¶
OpenPlan is the shared click-placement answer. Retarget names an existing leaf of the requested kind; otherwise Split names the leaf to divide.
func ApplyAxisOverride ¶ added in v1.0.0
ApplyAxisOverride rewrites a split plan's axis from the CLI --split flag. auto / empty leave PlanOpen's axis alone. A retarget is unchanged: --split never forces a second leaf of a kind that already exists, and it never retargets the named leaf onto the terminal.
func PlanOpen ¶
PlanOpen keeps the primary content in a full-height left column: the first content opens beside it, a different content kind stacks in the right column, a later content kind stacks on the largest content leaf, and a repeated kind retargets its existing leaf. boxes may be nil; ties and missing geometry follow the first content leaf in the tree.
func PlanOpenContent ¶ added in v1.3.0
PlanOpenContent is PlanOpen for a named piece of content. A duplicable kind never retargets a leaf showing something else — every open is a new session — but it does retarget the leaf already showing this exact content, which is what keeps one tmux session out of two leaves.
type Target ¶ added in v1.0.0
type Target struct {
Kind TargetKind
Leaf int
}
Target is a single focusable window. Leaf is meaningful only for TargetLeaf.
func CycleTarget ¶ added in v1.0.0
CycleTarget returns the next target after current, wrapping at both ends. A current target that is not in the ring starts the cycle at the first entry (the last when reverse); an empty ring leaves focus where it is.
func Ring ¶ added in v1.0.0
Ring lists the focusable windows in cycle order: the sidebar (when visible), then every tree leaf in placement order, then the terminal panel (when visible). Leaf order matches the A-then-B walk LayoutPanes performs, so Tab follows the same sequence the panes are drawn in.
Shell leaves are not leaf stops: the panel is the stop that names them, so a ring that listed both would stop on the same window twice.
func RingStart ¶ added in v1.2.0
RingStart is the entry a cycle resumes at when focus comes back to a surface from a shell-owned stop: the first window going forward, the last going back.
func TwoPaneRing ¶ added in v1.2.0
TwoPaneRing is Ring for the surfaces whose layout is a list beside one content pane rather than a tree. Either window may be off screen — a hidden sidebar, a content pane with nothing selected to draw — and a window that is not drawn is not a stop, exactly as with the tree ring.
It exists so that "the ring" has one definition for those surfaces too: the shell inserts the notification centre at the wrap point of whatever this returns, and the surface's own Tab toggle stays its own.
type TargetKind ¶ added in v1.0.0
type TargetKind int
TargetKind names the sort of window a focus target refers to.
const ( // TargetSidebar is the workspace list beside the preview. TargetSidebar TargetKind = iota // TargetLeaf is a pane-tree leaf, identified by Target.Leaf. TargetLeaf // TargetTermPanel is the terminal panel's entry. The panel is a Shell leaf // of the tree, but which of the two live terminals owns the KEYBOARD is not // the leaf ring's answer on that host, so the panel is named separately and // Shell leaves are skipped in the leaf walk. TargetTermPanel )