term

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Crop

func Crop(text string, length int) (string, int)

Crop ensures that the supplied text is cropped to the target length. If it exceeds the target length, the last (max) 3 characters are replaced with ellipsis. Returned are the cropped string, and the final visible length after cropping.

func Measure

func Measure(text string) int

Measure returns the number of horizonal space the provided text accounts for. This will filter out escape characters, and treat multi-byte unicode characters as single space tenants.

func PadRight

func PadRight(text string, maxLength int, gutter int) string

PadRight pads text to the right, cropping anything over the supplied maxLength, preserving up to n gutter chars on the right.

func StripTerminalEscapeSequences added in v0.2.3

func StripTerminalEscapeSequences(data []byte) []byte

StripTerminalEscapeSequences removes all terminal escape sequences from the provided string, and returns the remaining string

Types

This section is empty.

Jump to

Keyboard shortcuts

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