Documentation
¶
Overview ¶
Package capprobe holds the terminal capability probe's wire format: the queries a Program writes at start-up and the parser that turns the replies into a Result. It does no I/O and keeps no locks: the runtime owns the timing, the goroutines and the delivery of the result to the model, and this package only knows what the bytes mean, so it can be tested against recorded replies from real terminals.
Index ¶
Constants ¶
const ( QueryDECRQM2026 = "\x1b[?2026$p" QueryDECRQM2027 = "\x1b[?2027$p" QueryKittyKeyboard = "\x1b[?u" QueryKittyGraphics = "\x1b_Gi=31,s=1,v=1,a=q,t=d,f=24;AAAA\x1b\\" QueryXTVersion = "\x1b[>0q" QueryNotify = "\x1b]99;i=32:p=?;\x1b\\" QueryDA1 = "\x1b[c" // Queries is every query, in the order they are written. Queries = QueryDECRQM2026 + QueryDECRQM2027 + QueryKittyKeyboard + QueryKittyGraphics + QueryXTVersion + QueryNotify + QueryDA1 )
The probe queries. DA1 goes last: terminals answer in order, so its reply means every earlier query has been answered or ignored.
const ( ClusterModeEnable = "\x1b[?2027h" ClusterModeDisable = "\x1b[?2027l" )
Mode 2027 (grapheme cluster width) set and reset.
Variables ¶
This section is empty.
Functions ¶
func InferStyledUnderline ¶
InferStyledUnderline reports whether extended underlines (SGR 4:n) are believed to render: true when the terminal spoke a kitty protocol or its XTVERSION names a terminal known to support them. It is inferred, not queried.
Types ¶
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser accumulates probe replies. The zero value is ready. It is not safe for concurrent use; the caller serialises Observe.
func (*Parser) Observe ¶
Observe feeds one terminal reply: kind is the introducer of a string reply (']' OSC, 'P' DCS, '_' APC) or '[' for a CSI reply, and data is the payload without introducer or terminator (for CSI, the bytes between "ESC[" and the final byte inclusive).
consumed reports that the reply belongs to the probe and must not reach the model. done reports that the DA1 sentinel arrived: res is then the final Result and the probe is over.
type Result ¶
type Result struct {
SyncOutput bool
GraphemeClusters bool
KittyKeyboard bool
KittyGraphics bool
Sixel bool
StyledUnderline bool
Notifications bool
XTVersion string
}
Result is what the terminal reported. The zero value means "nothing was confirmed", which is also what a terminal that never answers yields. The fields are documented on tui.Capabilities, which has the same shape.