Core Library0.xAPI Reference

Choose documentation 3

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

Go API

method libtmux-go latest

Pane.WaitForText

WaitForText polls the receiver's visible screen until it holds req.Text, the pane or server ends, or ctx ends. It polls on every supported tmux release and never opens a control client; PaneObservation.WaitFor is the push-based wait for tmux 3.7 and newer.

Source and package
Qualified name
tmux.Pane.WaitForText
Package
tmux
Declared in
Pane
Distribution
github.com/libtmux/libtmux-go/tmux
Source
tmux/pane_text_wait.go

Description#

The wait is level-triggered. Text already on screen matches at once, with PaneTextWait.MatchedAtEntry set, and so does a shell's echo of a typed command that contains req.Text. Match on what the command prints, not on the command: printf 'NEE%s' DLE never puts NEEDLE in the typed line. PaneObservation.WaitFor differs by reporting only output after its baseline. A caller who needs only new output on tmux 3.3a through 3.6 checks the screen before typing and picks text the screen lacks.

Only the visible screen is read, never history, so text that has scrolled off is not seen. Wrapped rows are joined, so text may straddle the wrap column. A poll sees the final state of text a program overwrote with a carriage return, and text printed before a full-screen program started is not on the screen being read.

Every read is one ordinary tmux process, so a server bound to a Connection is refused with ErrConnectionRequiresProcess . Each read runs the owner's after-capture-pane hook, and a hook that prints adds its output to the text. The read asks for liveness through run-shell, which fires no hook.

The text is matched before the pane's liveness is acted on, so a complete read of a pane that has since died still matches. A pane or server that ends first returns a PaneEndedError . A deadline or cancel returns ctx.Err, with the text of the last complete read. An empty req.Text or a negative interval fails before any tmux command runs with ErrInvalidWaitForText .

Esc

Type to search.

Reference previewOpen reference