frame

package
v0.0.19 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package frame assembles the TUI 2.0 screen from panel content and a layout budget.

It exists to make one property true by construction: every rendered row is exactly the terminal width. Panels hand it whatever they draw — too short, too long, styled, full of wide runes — and the frame fits each line to its region before joining regions with one-cell rules.

That inversion is what makes the borderless design safe to adopt incrementally. The old frame relied on Lipgloss borders to absorb whatever slop a panel produced; remove the borders and every panel has to be exact-width on its own, which is a large simultaneous change. Here the frame does the fitting, so a panel that is not yet exact simply gets padded or clipped instead of shearing the screen.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Lines

func Lines(view string) []string

Lines splits a panel's rendered output into rows for a Column. It exists so callers do not each re-derive how to turn a View() string into rows, including the trailing-newline case that would otherwise add a phantom blank row at the bottom of a panel.

func Render

func Render(s Screen) string

Render returns the complete screen: Layout.Height rows, each exactly Layout.Width cells.

Types

type Column

type Column struct {
	Width   int
	Surface lipgloss.Color
	Lines   []string
}

Column is one region's content: the lines it drew, the width it was budgeted, and the surface it is drawn on. Lines shorter than Height are padded with blanks; longer ones are clipped.

Surface is the frame's second job, and the reason panels do not paint their own base colour. A panel can only fill the rows it drew; the frame also owns the rows it did NOT draw — the blank padding under a short chat list, the empty-state views that go through lipgloss's own Height, and the whole column in single-panel mode. Painting in one place is what makes "no cell falls through to the terminal's default" true of the screen rather than of most of it.

Panels still paint their exceptions, and those win: cell.Fill reopens the surface before each span's own sequences, so a selected chat row that filled itself sel stays sel underneath a column filled with panel.

type Screen

type Screen struct {
	Layout layout.Layout
	Roles  theme.Roles

	// TopBar and HintBar are already-rendered full-width rows. Empty when
	// the layout says they are not shown.
	TopBar  string
	HintBar string

	// Body columns, left to right. A column with Width 0 is skipped along
	// with its rule.
	ChatList Column
	Thread   Column
	Rail     Column
}

Screen is everything the frame needs to draw.

Jump to

Keyboard shortcuts

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