Skip to content

Commit fcaa95b

Browse files
committed
docs(CHANGES): Document capture_pane() enhancements (#613)
why: Document the new capture_pane() parameters for the changelog. what: - Add section for Pane.capture_pane() enhanced - Document all 5 new parameters with flag mappings - Add code examples for colored output and joined lines - Note trim_trailing requires tmux 3.4+
1 parent 374ca6f commit fcaa95b

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

CHANGES

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,41 @@ def test_cli_output(pane, textframe_snapshot):
163163
- Uses `overflow_behavior="truncate"` by default for CI robustness
164164
- Accepts same `start` / `end` parameters as `capture_pane()`
165165

166+
#### Pane.capture_pane() enhanced (#613)
167+
168+
The {meth}`~libtmux.pane.Pane.capture_pane` method now supports 5 new parameters
169+
that expose additional tmux `capture-pane` flags:
170+
171+
| Parameter | tmux Flag | Description |
172+
|-----------|-----------|-------------|
173+
| `escape_sequences` | `-e` | Include ANSI escape sequences (colors, attributes) |
174+
| `escape_non_printable` | `-C` | Escape non-printable chars as octal `\xxx` |
175+
| `join_wrapped` | `-J` | Join wrapped lines back together |
176+
| `preserve_trailing` | `-N` | Preserve trailing spaces at line ends |
177+
| `trim_trailing` | `-T` | Trim trailing empty positions (tmux 3.4+) |
178+
179+
**Capturing colored output:**
180+
181+
```python
182+
# Capture with ANSI escape sequences preserved
183+
pane.send_keys('printf "\\033[31mRED\\033[0m"', enter=True)
184+
output = pane.capture_pane(escape_sequences=True)
185+
# Output contains: '\x1b[31mRED\x1b[0m'
186+
```
187+
188+
**Joining wrapped lines:**
189+
190+
```python
191+
# Long lines that wrap are joined back together
192+
output = pane.capture_pane(join_wrapped=True)
193+
```
194+
195+
**Version compatibility:**
196+
197+
The `trim_trailing` parameter requires tmux 3.4+. If used with an older version,
198+
a warning is issued and the flag is ignored. All other parameters work with
199+
libtmux's minimum supported version (tmux 3.2a).
200+
166201
## libtmux 0.51.0 (2025-12-06)
167202

168203
### Breaking changes

0 commit comments

Comments
 (0)