On this page
Server.capture(_:since:limit:)
- 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
-
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
nilto 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
nilto start watching. - limit: the most lines to return, keeping the newest.
- Raises
In other languages Read a pane’s visible contents
- Python
libtmux.Pane.capture_pane - TypeScript
pane.Pane.capture - Rust
pane.observe.Pane.capture - Go
tmux.Pane.Capture - Java
io.github.libtmux.Pane.Pane.capture - .NET
LibTmux.Pane.CaptureAsync - C++
libtmux::Pane::capture
- Parameters:
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