libtmux Reference MCP Search
On this page

Server.capture(_:since:limit:)

View as Markdown

Declared in
Server
Package
libtmux-swift
Source
Sources/LibTmux/CaptureSince.swift
Other languages
PythonTypeScriptRustGoJava.NETC++
capture(_:since:limit:) ( pane : Pane , since : CaptureCursor? , limit : Int ) IncrementalCapture
methodasync [source]
methodasync [source]
capture(_:since:limit:)

Reads only what a pane has printed since cursor .

Watching a pane by capturing it repeatedly sends the whole screen every time, nearly all of which the caller has already seen — which for an agent is context spent on nothing. This sends the difference.

Pass nil to start: the first read establishes where the pane is without returning its backlog, so a watcher begins at "from now on" rather than with a screenful of history. The source read is capped at 1 MiB; a wider result fails instead of allocating output the line limit would later discard.

  • Parameters:
    • pane: the pane to read.
    • cursor: where the last read stopped, or nil to start watching.
    • limit: the most lines to return, keeping the newest.
Raises
In other languages Read a pane’s visible contents

Examples

>>> pane = window.split(shell='sh')
>>> pane.capture_pane()
['$']
>>> pane.send_keys('echo "Hello world"', enter=True)
>>> pane.capture_pane()
['$ echo "Hello world"', 'Hello world', '$']
>>> print(chr(10).join(pane.capture_pane()))
$ echo "Hello world"
Hello world
$
const lines = await pane.capture();
lines.at(-1);

0 declared, 0 inherited

Esc

Type to search.