On this page
libtmux::Pane::capture
- Module
- libtmux
- Declared in
- Pane
- Package
- libtmux-cxx
- Source
- include/libtmux/entities.hpp
- Other languages
- PythonTypeScriptRustGoJava.NETSwift
- capture ( ) expected< std::string, CommandFailure > ( options : CaptureOptions ) expected< std::string, CommandFailure >
-
The visible contents, as tmux printed them.
capture_linesframes it into lines, and takes a named string: the lines are views into it, so framing this return value directly is a compile error rather than a dangling read.A pane's scrollback can be far larger than the default bound, and a capture that does not fit is reported rather than cut, so a caller reading history passes the size it is prepared to hold.
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 - Swift
Server.capture(_:since:limit:)
- Python
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