cells

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FillLeft

func FillLeft(s string, width int) string

FillLeft pads a string on the left to reach the given cell width.

func FillRight

func FillRight(s string, width int) string

FillRight pads a string on the right to reach the given cell width.

func Len

func Len(s string) int

Len returns the number of terminal cells needed to display the string. This accounts for double-width characters (CJK), zero-width characters, and other Unicode properties that affect terminal display width.

func RuneWidth

func RuneWidth(r rune) int

RuneWidth returns the number of terminal cells needed to display a single rune.

func SanitizeOSC added in v1.0.2

func SanitizeOSC(s string) string

SanitizeOSC removes ANSI escape characters and string terminators from a string intended for embedding in an OSC escape sequence.

func Truncate

func Truncate(s string, width int, tail string) string

Truncate truncates a string to fit within the given cell width, appending the tail string if truncation occurs.

func Wrap

func Wrap(s string, width int) string

Wrap wraps a string at the given cell width.

Types

This section is empty.

Jump to

Keyboard shortcuts

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