Documentation
¶
Overview ¶
Package wordwrap provides terminal-aware word wrapping for streaming text output.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TerminalWidth ¶
TerminalWidth returns the current terminal width, or fallback if unavailable.
Types ¶
type StreamWriter ¶
type StreamWriter struct {
// contains filtered or unexported fields
}
StreamWriter wraps streaming text output at the given column width. It buffers partial words and flushes complete wrapped lines.
func NewStreamWriter ¶
func NewStreamWriter(width int, output func(string)) *StreamWriter
NewStreamWriter creates a streaming word wrapper. width=0 means no wrapping (passthrough).
func (*StreamWriter) Flush ¶
func (w *StreamWriter) Flush()
Flush outputs any remaining buffered content.
func (*StreamWriter) Write ¶
func (w *StreamWriter) Write(token string)
Write processes a token from the LLM stream.
Click to show internal directories.
Click to hide internal directories.