panelayout

package
v0.99.1 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: MIT Imports: 1 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 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

This section is empty.

Variables

This section is empty.

Functions

func ClampRatio

func ClampRatio(ratio int) int

func LayoutPanes

func LayoutPanes(root *Node, box Box, floors Floors) (leaves []Placement, dividers []Divider, fits bool)

func MaxID

func MaxID(node *Node) int

func SetRatio

func SetRatio(root *Node, splitID, ratio int) bool

Types

type Axis

type Axis int
const (
	Columns Axis = iota
	Rows
)

type Box

type Box = termpreview.Box

type Divider

type Divider struct {
	SplitID int
	Axis    Axis
	Box     Box
}

type Floor

type Floor struct{ Width, Height int }

type Floors

type Floors struct {
	Terminal Floor
	Doc      Floor
	Issue    Floor
}

type Kind

type Kind int
const (
	Terminal Kind = iota
	Document
	Issue
)

type Layout

type Layout struct {
	Leaves   []Placement
	Dividers []Divider
	Zoomed   bool
}

func LayoutTree

func LayoutTree(root *Node, box Box, floors Floors, focus int) (Layout, bool)

type Node

type Node struct {
	ID        int
	Kind      Kind
	ContentID int
	Split     *Split
}

func Clone

func Clone(node *Node) *Node

Clone returns a detached copy suitable for trial layout before committing a split that may not fit the current viewport.

func Close

func Close(root *Node, leafID int) (*Node, int)

func Find

func Find(root *Node, id int) *Node

func FirstOfKind

func FirstOfKind(node *Node, kind Kind) *Node

func SplitLeaf

func SplitLeaf(root *Node, leafID int, axis Axis, newLeaf *Node) (*Node, int)

type OpenPlan

type OpenPlan struct {
	Retarget int
	Split    int
	Axis     Axis
}

OpenPlan is the shared click-placement answer. Retarget names an existing leaf of the requested kind; otherwise Split names the leaf to divide.

func PlanOpen

func PlanOpen(root *Node, kind Kind) (OpenPlan, bool)

PlanOpen keeps the terminal in a full-height left column: the first content opens beside it, a different content kind stacks in the right column, and a repeated kind retargets its existing leaf.

type Placement

type Placement struct {
	Node *Node
	Box  Box
}

type Split

type Split struct {
	Axis  Axis
	Ratio int
	A, B  *Node
}

Jump to

Keyboard shortcuts

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