Documentation
¶
Overview ¶
Package termtext removes terminal control sequences from text that came from a model, a tool or another external source before chat writes it to a terminal.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cleaner ¶
type Cleaner struct {
// contains filtered or unexported fields
}
Cleaner consumes terminal text incrementally. Escape sequences can be split across model deltas, so callers must keep one Cleaner for one displayed text stream and call Flush when that stream ends.
func (*Cleaner) Flush ¶
Flush ends the current stream. An incomplete escape sequence or UTF-8 byte sequence is discarded; it is not safe to carry it into the next message.
func (*Cleaner) Write ¶
Write removes C0/C1 controls and terminal escape sequences from value. Newline and tab are retained; every other control is removed rather than replaced so the terminal cannot interpret a visible-looking replacement as part of an escape sequence, and normal text is not made noisier by security markers.