layout

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	KEYWORD_PANE    = janet.Keyword("pane")
	KEYWORD_SPLIT   = janet.Keyword("split")
	KEYWORD_MARGINS = janet.Keyword("margins")
	KEYWORD_BORDERS = janet.Keyword("borders")

	// Special border behavior
	KEYWORD_NONE = janet.Keyword("none")
)

Functions

func Attached

func Attached(layout Layout) *tree.NodeID

Attached returns the ID field of the attached pane in the layout.

func IsAttached added in v0.6.0

func IsAttached(tree NodeType) bool

IsAttached reports whether the node provided leads to a node that is attached.

func ValidateTree added in v0.6.0

func ValidateTree(tree NodeType) error

ValidateTree inspects a tree and ensures that it conforms to all relevant constraints, namely there should only be one PaneType with Attached=true.

Types

type BorderType added in v0.5.0

type BorderType struct {
	Title       *string
	TitleBottom *string
	Border      *style.Border
	BorderFg    *style.Color
	BorderBg    *style.Color
	Node        NodeType
}

type Layout

type Layout struct {
	Root NodeType
}

func Attach

func Attach(layout Layout, id tree.NodeID) Layout

Attach changes the currently attached tree node to the one specified by id.

func New

func New(node NodeType) Layout

func (*Layout) MarshalJanet

func (l *Layout) MarshalJanet() interface{}

func (*Layout) UnmarshalJanet

func (l *Layout) UnmarshalJanet(value *janet.Value) (err error)

type MarginsType

type MarginsType struct {
	Cols     int
	Rows     int
	Frame    *string
	Border   *style.Border
	BorderFg *style.Color
	BorderBg *style.Color
	Node     NodeType
}

type NodeChangeEvent added in v0.6.0

type NodeChangeEvent struct {
	Config NodeType
}

type NodeRemoveEvent added in v0.6.0

type NodeRemoveEvent struct{}

type NodeType

type NodeType interface{}

func AttachFirst added in v0.6.0

func AttachFirst(node NodeType) NodeType

AttachFirst attaches to the first node it can find.

func Detach added in v0.6.0

func Detach(node NodeType) NodeType

Detach returns a copy of node with no attachment points.

func RemoveAttached added in v0.6.0

func RemoveAttached(node NodeType) NodeType

RemoveAttached removes the attached node by replacing its nearest parent that has more than one child with a parent with that child removed, or the other child if there are no other children.

type PaneType

type PaneType struct {
	Attached     bool
	RemoveOnExit *bool
	ID           *tree.NodeID
}

type Reusable added in v0.6.0

type Reusable interface {
	mux.Screen
	Apply(NodeType) (bool, error)
}

Reusable is used to describe a Screen that has a configuration that can change. Often a Screen does not actually need to be created from scratch when the corresponding layout node changes; it can just be updated. The reuse function checks whether the Screen can be updated to match the new configuration and updates it if possible.

type SplitType

type SplitType struct {
	Vertical bool
	Percent  *int
	Cells    *int
	Border   *style.Border
	BorderFg *style.Color
	BorderBg *style.Color
	A        NodeType
	B        NodeType
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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