Help us shape the future of Go! Take the 2026 Go Developer Survey

query

package
v1.233.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package query answers terminal capability queries on behalf of a terminal that cannot.

TUI libraries such as bubbletea v1 and termenv probe the terminal at startup with OSC 10/OSC 11 (foreground/background color) and CSI 6n (cursor position) and wait several seconds for each reply. When Atmos owns the pseudo-terminal (for example a recorded session or a PTY without forwarded host input) nothing answers, so every child process would stall. Responder scans PTY output for those queries and writes the replies back to the PTY so children start immediately.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

Reader forwards everything read from the source unchanged while answering terminal queries.

func NewReader

func NewReader(src io.Reader, sink io.Writer) *Reader

NewReader wraps src so any terminal query read from it is answered on sink. The bytes returned by Read are identical to those produced by src.

func (*Reader) Read

func (r *Reader) Read(p []byte) (int, error)

Read implements io.Reader.

type Responder

type Responder struct {
	// contains filtered or unexported fields
}

Responder detects terminal queries in a stream of output and writes replies to a sink. It is safe for concurrent use and tolerates queries split across Scan calls.

func NewResponder

func NewResponder(sink io.Writer) *Responder

NewResponder returns a Responder that writes replies to sink (typically the PTY master). A nil sink disables replies.

func (*Responder) Scan

func (r *Responder) Scan(chunk []byte)

Scan inspects a chunk of terminal output and answers every query that completes in it. A query is answered exactly once even when it spans multiple chunks.

Jump to

Keyboard shortcuts

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