Documentation
¶
Overview ¶
Package terminaltext provides terminal-safe plain-text rendering helpers for mecatui UI and status-line renderers.
Index ¶
Constants ¶
const DefaultTabWidth = 4
DefaultTabWidth is the fixed spaces-per-tab policy for plain-text display paths without a style. It matches Lip Gloss's default tab width.
Variables ¶
This section is empty.
Functions ¶
func ExpandStyleTabs ¶ added in v0.0.49
ExpandStyleTabs expands tabs using the style's effective conversion policy before display measurement or wrapping. It leaves all other text unchanged.
func ExpandTabs ¶ added in v0.0.49
ExpandTabs replaces each tab with width spaces before display measurement or wrapping. Zero removes tabs; a negative width preserves them. This matches Lip Gloss's fixed-width conversion, not column-dependent terminal tab stops. It does not sanitize text or interpret Markdown.
func NormalizeWidth ¶
NormalizeWidth rewrites text so Lip Gloss's WcWidth and GraphemeWidth agree for every grapheme cluster. It preserves agreeing clusters, then tries removing VS16, keeping the first scalar, and finally U+FFFD.
func Sanitize ¶
Sanitize removes terminal controls from plain text while preserving layout newlines and tabs. It removes C0 controls, ESC, DEL, C1 controls, and Unicode Cf format characters. Markdown must not pass through this function.
func SanitizeSingleLine ¶
SanitizeSingleLine removes terminal controls from a single-line display value. Unlike Sanitize, it removes layout newlines, tabs, U+2028, and U+2029.
Types ¶
This section is empty.