Help us shape the future of Go! Take the 2026 Go Developer Survey

terminaltext

package
v0.0.45 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package terminaltext provides terminal-safe plain-text rendering helpers for mecatui UI and status-line renderers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NormalizeWidth

func NormalizeWidth(src string) string

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

func Sanitize(s string) string

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

func SanitizeSingleLine(s string) string

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.

Jump to

Keyboard shortcuts

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