layout

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpandTabs

func ExpandTabs(s string) string

ExpandTabs replaces tab characters with four spaces.

func Fill

func Fill(output string, width, height int) string

Fill expands tabs and pads the output with blank rows to fill the terminal.

func HardWrap

func HardWrap(line string, width int) []string

HardWrap splits a single line into multiple rows at width, preserving ANSI escape sequences across the break. Returns the original line in a single-element slice when no wrapping is needed.

func NormalizeLine

func NormalizeLine(line string, width int) string

NormalizeLine expands tabs, clamps visual width, and pads the line to width.

func NormalizeLines

func NormalizeLines(lines []string, width int) []string

NormalizeLines applies NormalizeLine to each line.

func PreserveBackground

func PreserveBackground(line, bg string) string

PreserveBackground wraps a line with a background escape and re-applies it after every embedded SGR sequence so inner ANSI styling does not clear the row background.

func PreserveBackgroundWidth

func PreserveBackgroundWidth(line, bg string, width int) string

PreserveBackgroundWidth behaves like PreserveBackground and pads the visible line to the requested terminal width.

func Separator

func Separator(width, junctionCol int) string

Separator returns a horizontal rule of width characters. If junctionCol is non-negative and within width, a ┬ junction is placed at that column.

func WrapLines

func WrapLines(text string, width int) []string

WrapLines splits text on newlines, expands tabs, and hard-wraps each line to width. Returns the resulting rows.

Types

This section is empty.

Jump to

Keyboard shortcuts

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