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.

method libtmux-rs latest

Pane.capture_with

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

Source and package
Qualified name
libtmux::pane::Pane::capture_with
Module
pane
Declared in
Pane
Package
libtmux
Source
crates/libtmux/src/pane/observe.rs
pub async fn capture_with( &self, options: CaptureOptions ) -> Result<Vec<TmuxText>, Error>

Description#

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());
Parameters

tmux command#

The tmux commands behind capture_with.

tmux C API#

The C declarations in tmux that implement these commands.

Esc

Type to search.

Reference previewOpen reference