text

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package text holds the small string helpers that were re-implemented across the tree: rune-safe clipping (one of the copies sliced bytes and could split a multibyte character), single-line collapsing, and multi-substring matching. Classification predicates and display truncation both hang on these, so they live once. Display-width truncation for the TUI is a different concern (cell width, ANSI sequences) and stays with the TUI's ansi tooling.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clip

func Clip(s string, n int) string

Clip shortens s to at most n runes, appending "..." when it cut. The cut end is trimmed of trailing spaces so a clip never renders " ...". Rune-based on purpose: a byte slice can split a multibyte character and produce invalid UTF-8.

func ContainsAny

func ContainsAny(s string, subs ...string) bool

ContainsAny reports whether s contains any of the substrings. Callers normalize case themselves when they need to.

func OneLine

func OneLine(s string, n int) string

OneLine collapses whitespace runs (including newlines) into single spaces and clips to n runes, so a multi-line tool output or model message renders as a single tidy line.

Types

This section is empty.

Jump to

Keyboard shortcuts

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