Documentation
¶
Overview ¶
Package textutil holds small string helpers shared by tools and the TUI.
Package textutil holds small string helpers shared by tools and the TUI.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GlobToRegex ¶
GlobToRegex converts a slash-separated glob to an unanchored regex body using only syntax understood by both Go and the macOS sandbox profile language.
func HTMLToText ¶ added in v0.7.0
HTMLToText extracts readable text from HTML: scripts and styles are dropped, block elements become line breaks, headings and list items keep light Markdown markers, and links keep their absolute targets.
func SanitizeTerminal ¶
SanitizeTerminal strips control characters that a terminal would interpret (ESC sequences, BEL, backspace, carriage return, C1 controls) so untrusted text from models, files, or tool output cannot rewrite the screen, change the window title, or write to the clipboard via OSC 52. Newlines and tabs are kept. Invalid UTF-8 is replaced with U+FFFD.
func Tail ¶ added in v0.8.3
Tail is the end of s, at most n bytes on a rune boundary, after "…" when cut: where a command's output says what went wrong.
func TrimPartialRune ¶
TrimPartialRune drops an incomplete multi-byte rune from the end of s, as left behind when a byte stream is cut at an arbitrary offset.
func TruncateUTF8 ¶
TruncateUTF8 returns s cut to at most n bytes without splitting a multi-byte rune.
Types ¶
This section is empty.