v0.52.0 - `send_keys()` updates
libtmux 0.52.0
capture_pane() enhancements
The Pane.capture_pane() method now supports 5 new parameters exposing additional tmux capture-pane flags:
| Parameter | tmux Flag | Description |
|---|---|---|
escape_sequences |
-e |
Include ANSI escape sequences (colors, attributes) |
escape_non_printable |
-C |
Escape non-printable chars as octal \xxx |
join_wrapped |
-J |
Join wrapped lines back together |
preserve_trailing |
-N |
Preserve trailing spaces at line ends |
trim_trailing |
-T |
Trim trailing empty positions (tmux 3.4+) |
Examples
Capturing colored output:
# Capture with ANSI escape sequences preserved
pane.send_keys('printf "\\033[31mRED\\033[0m"', enter=True)
output = pane.capture_pane(escape_sequences=True)
# Output contains: '\x1b[31mRED\x1b[0m'Joining wrapped lines:
# Long lines that wrap are joined back together
output = pane.capture_pane(join_wrapped=True)Version compatibility
The trim_trailing parameter requires tmux 3.4+. If used with an older version, a warning is issued and the flag is ignored. All other parameters work with libtmux's minimum supported version (tmux 3.2a).
What's Changed
Full Changelog: v0.51.0...v0.52.0