textbound

package
v0.3.0 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: 2 Imported by: 0

Documentation

Overview

Package textbound cuts text to a byte bound without splitting a character. A cut at a raw byte offset can land inside a multi-byte UTF-8 sequence, and the half character it leaves is invalid UTF-8: a protobuf string field then refuses the whole message it sits in. On 2026-10-05 that made the harness chat page unable to connect for any session whose transcript held such a cut.

Index

Constants

View Source
const Ellipsis = "…"

Ellipsis marks text that was cut.

Variables

This section is empty.

Functions

func Prefix

func Prefix(text string, limit int) string

Prefix is text cut to at most limit bytes on a character boundary, with Ellipsis appended when anything was cut. Invalid UTF-8 already in text is replaced, so the result is always valid. A limit below one cuts everything.

Types

This section is empty.

Jump to

Keyboard shortcuts

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