libtmux Reference MCP Search
On this page

pane.observe.Pane.capture_with

View as Markdown

Module
pane.observe
Declared in
Pane
Package
libtmux
Source
crates/libtmux/src/pane/observe.rs
capture_with ( self , options : CaptureOptions ) Result<Vec<TmuxText>, Error>
method [source]
method [source]
capture_with

Read the pane's contents, choosing how much and in what form.

Pane::capture reads the visible screen. This reaches into scrollback, which is where the output a caller is looking for has usually gone by the time anyone asks.

Errors

Returns an error when tmux refuses the capture, which includes a pane that has been closed.

Examples

use libtmux::CaptureOptions;

let session = server.new_session("captured").await?;
let pane = session.panes().await?.remove(0);

let visible = pane.capture_with(CaptureOptions::visible()).await?;
let everything = pane.capture_with(CaptureOptions::history()).await?;
assert!(everything.len() >= visible.len());

let last_ten = pane.capture_with(CaptureOptions::visible().start(-10)).await?;
assert!(last_ten.len() >= visible.len());

0 declared, 0 inherited

Esc

Type to search.