# libtmux::Pane::capture

- **Module:** libtmux::Pane
- **Package:** libtmux-cxx
- **Language:** C++
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-cxx/blob/85e8bd603a322dc32bb8b9aeb1a72bcf36945f1d/include/libtmux/entities.hpp#L631
- **Page:** https://libtmux.org/reference/cxx/libtmux-pane-capture/

```
libtmux::Pane::capture() -> expected< std::string, CommandFailure >
```

The visible contents, as tmux printed them.

`capture_lines` frames 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.
