Skip to content

Commit 7113106

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 601c322 commit 7113106

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
@@ -34,6 +34,41 @@ $ uvx --from 'libtmux' --prerelease allow python
3434

3535
_Upcoming changes will be written here._
3636

37+
#### Pane.capture_pane() enhanced (#614)
38+
39+
The {meth}`~libtmux.pane.Pane.capture_pane` method now supports 5 new parameters
40+
that expose additional tmux `capture-pane` flags:
41+
42+
| Parameter | tmux Flag | Description |
43+
|-----------|-----------|-------------|
44+
| `escape_sequences` | `-e` | Include ANSI escape sequences (colors, attributes) |
45+
| `escape_non_printable` | `-C` | Escape non-printable chars as octal `\xxx` |
46+
| `join_wrapped` | `-J` | Join wrapped lines back together |
47+
| `preserve_trailing` | `-N` | Preserve trailing spaces at line ends |
48+
| `trim_trailing` | `-T` | Trim trailing empty positions (tmux 3.4+) |
49+
50+
**Capturing colored output:**
51+
52+
```python
53+
# Capture with ANSI escape sequences preserved
54+
pane.send_keys('printf "\\033[31mRED\\033[0m"', enter=True)
55+
output = pane.capture_pane(escape_sequences=True)
56+
# Output contains: '\x1b[31mRED\x1b[0m'
57+
```
58+
59+
**Joining wrapped lines:**
60+
61+
```python
62+
# Long lines that wrap are joined back together
63+
output = pane.capture_pane(join_wrapped=True)
64+
```
65+
66+
**Version compatibility:**
67+
68+
The `trim_trailing` parameter requires tmux 3.4+. If used with an older version,
69+
a warning is issued and the flag is ignored. All other parameters work with
70+
libtmux's minimum supported version (tmux 3.2a).
71+
3772
## libtmux 0.51.0 (2025-12-06)
3873

3974
### Breaking changes

0 commit comments

Comments
 (0)