layout

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: BSD-3-Clause Imports: 0 Imported by: 0

Documentation

Overview

Package layout computes terminal layout metrics for codexsm TUI rendering.

Index

Constants

View Source
const (
	// MinWidth is the minimal terminal width required by TUI.
	// This is driven by the main panes, not the keybar. The keybar can degrade
	// to shorter variants at narrower widths, so the minimum should reflect the
	// actual split-pane layout requirement plus the terminal-edge safety margin.
	MinWidth = 118
	// MinHeight is the minimal terminal height required by TUI.
	MinHeight = 24
)

Variables

This section is empty.

Functions

func IsTooSmall

func IsTooSmall(width, height int) bool

IsTooSmall reports whether current terminal size is below supported bounds.

func NormalizeSize

func NormalizeSize(width, height int) (int, int)

NormalizeSize applies fallback values when terminal size is unavailable.

func RenderWidth added in v0.2.4

func RenderWidth(width int) int

RenderWidth returns a width safe for rendering without hitting the terminal's last column, which can trigger autowrap and break borders in some terminals.

Types

type Metrics

type Metrics struct {
	TotalW        int
	TotalH        int
	KeysOuterH    int
	MainAreaH     int
	GapW          int
	LeftOuterW    int
	RightOuterW   int
	InfoOuterH    int
	PreviewOuterH int
}

Metrics describes the top-level dimensions used by TUI panels.

func Compute

func Compute(width, height int) Metrics

Compute calculates panel dimensions for a normalized terminal size.

Jump to

Keyboard shortcuts

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