# LibTmux.Server.waitForText

- **Package:** libtmux-haskell
- **Language:** Haskell
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-haskell/blob/72edb54317bf619c6dc54bff311844f062f8984c/src/LibTmux/Server.hs#L1062
- **Page:** https://libtmux.org/en/haskell/latest/reference/libtmux-server-v-waitfortext/

```haskell
waitForText
  :: Server
  -> PaneRef
  -> PaneWaitOptions
  -> Text
  -> IO PaneWaitResult
```

Signature types: [`Server`](/en/haskell/latest/reference/libtmux-server-t-server/), [`PaneRef`](/en/haskell/latest/reference/libtmux-snapshot-t-paneref/), [`PaneWaitOptions`](/en/haskell/latest/reference/libtmux-server-t-panewaitoptions/), [`Text`](https://hackage.haskell.org/package/text-2.1.3/docs/Data-Text.html#t:Text), [`IO`](https://hackage.haskell.org/package/base-4.22.0.0/docs/Prelude.html#t:IO), [`PaneWaitResult`](/en/haskell/latest/reference/libtmux-server-t-panewaitresult/).

Observe a nonempty, case-sensitive substring in an exact pane. The first
 capture runs immediately. After a nonmatch, check liveness and wait up to
 100 ms before the next capture. One deadline covers every request.

A fresh match requires absence followed by presence or an additional
 occurrence. Moving a match and repainting identical text provide no new
 evidence. A match can include terminal echo. Cancellation preserves its
 exception class and any in-flight [`CaptureRecovery`](/en/haskell/latest/reference/libtmux-recovery-t-capturerecovery/).

## Referenced declarations

- [`LibTmux.Snapshot.PaneRef`](/en/haskell/latest/reference/libtmux-snapshot-t-paneref/) (data type)
- [`LibTmux.Server.PaneWaitOptions`](/en/haskell/latest/reference/libtmux-server-t-panewaitoptions/) (data type)
- [`LibTmux.Server.PaneWaitResult`](/en/haskell/latest/reference/libtmux-server-t-panewaitresult/) (data type)
- [`LibTmux.Server.Server`](/en/haskell/latest/reference/libtmux-server-t-server/) (data type)

## tmux command

The tmux commands behind `waitForText`.

- [`capture-pane`](/en/tmux/latest/manual/capture-pane/)
- [`run-shell`](/en/tmux/latest/manual/run-shell/) (after a nonmatching capture)

## tmux C API

The C declarations in tmux that implement these commands.

- [`cmd_capture_pane_entry`](/en/tmux/latest/reference/c-variable-cmd_capture_pane_entry/) (attribute)
- [`cmd_capture_pane_exec`](/en/tmux/latest/reference/c-function-cmd-capture-pane-c-cmd_capture_pane_exec/) (function)
- [`cmd_run_shell_entry`](/en/tmux/latest/reference/c-variable-cmd_run_shell_entry/) (attribute)
- [`cmd_run_shell_exec`](/en/tmux/latest/reference/c-function-cmd-run-shell-c-cmd_run_shell_exec/) (function)

## Guides

Pages that discuss `waitForText`.

- [Change targets and observe pane text](/en/haskell/latest/guides/mutations/)
- [Implementation status](/en/haskell/latest/guides/status/)
