Documentation
¶
Overview ¶
Package layout decides where each region of the terminal interface goes for a given terminal size.
It is pure arithmetic, kept apart from the Bubble Tea model so that the parts most likely to be wrong at the edges — clamping, leftover rows, a terminal resized to almost nothing — can be tested directly rather than inferred from a rendered screen.
Index ¶
Constants ¶
const ( // BorderlessBelow is the width under which even the detail's border goes, // and a dialog becomes a sheet: at under 60 columns, two columns of // box-drawing are text that does not fit. BorderlessBelow = 60 )
Fixed regions and the rail's sizing rules.
Variables ¶
This section is empty.
Functions ¶
func ComputeWithNotice ¶
ComputeWithNotice is Compute with a row reserved for a notice above the footer: the notice takes the row the footer would have had, the footer stays at the true bottom, and the row comes out of the focused pane and the detail beside it alone, so every pane without focus keeps the lines it shows and the rail does not jump while a notice comes and goes. A caller reserves the row only where NoticeKeepsFocus holds. It returns the layout and the notice's box.
func NoticeKeepsFocus ¶ added in v0.7.0
NoticeKeepsFocus reports whether a notice can have a row of its own without taking the focused rail pane under the rows it had without one, down to focusedMinimum: where it would, the notice belongs in the footer's row.
Types ¶
type Layout ¶
Layout is where every region goes.
func Compute ¶
Compute lays out a terminal of the given size with the rail's panes stacked down its left.
func (Layout) Borderless ¶
Borderless reports a terminal too narrow to spend columns on a border.
func (Layout) CompactSpine ¶
CompactSpine reports a terminal too short for the spine's labels.
func (Layout) Dialog ¶ added in v0.11.0
Dialog is where a dialog that would like to be want goes: centered across the screen and in the upper third of the body between the spine and the footer, within DialogRoom, and at least dialogLeast columns wide. Below 60 columns there is no room to float, and it is a sheet over the whole body.
func (Layout) DialogRoom ¶ added in v0.11.0
DialogRoom is the most a floating dialog may take, its frame included: the screen less a margin each side, and the body less two rows. A dialog sized to fit what it says measures it within this room.
type Rail ¶ added in v0.9.0
type Rail struct {
Panes, Focused int
}
Rail is how many panes the rail stacks, and which of them, counted from zero, has focus.