libvt.tmux¶
Sans-I/O tmux capture-pane and control-mode (-CC) decoders.
-
class libvt.tmux.CaptureCompleteness¶class libvt.tmux.CaptureCompleteness¶
Bases:
objectExplicit fidelity report for a decoded
tmux capture-panesnapshot.
-
class libvt.tmux.TmuxCaptureResult¶class libvt.tmux.TmuxCaptureResult¶
Bases:
objectDecoded
tmuxcapture bundle ready for inspection or live streaming.
-
class libvt.tmux.TmuxLineFlags¶class libvt.tmux.TmuxLineFlags¶
Bases:
IntFlagPer-line flags emitted by
tmux capture-pane -F(tmux >= 3.8).
-
class libvt.tmux.TmuxPaneMetadata¶class libvt.tmux.TmuxPaneMetadata¶
Bases:
objectOut-of-band
tmuxpane state queried viaTMUX_METADATA_FORMAT.
-
libvt.tmux.decode_tmux_capture(captured, *, metadata=None, rows=24, cols=80, scrollback=None, flagged=False, joined_capture=None, saved_primary_capture=None, saved_primary_flagged=None, post_metadata=None, profile=TMUX_PROFILE, policy=TMUX_CAPTURE_POLICY, limits=DEFAULT_LIMITS)¶libvt.tmux.decode_tmux_capture(captured, *, metadata=None, rows=24, cols=80, scrollback=None, flagged=False, joined_capture=None, saved_primary_capture=None, saved_primary_flagged=None, post_metadata=None, profile=TMUX_PROFILE, policy=TMUX_CAPTURE_POLICY, limits=DEFAULT_LIMITS)¶
Reconstruct a
Terminalfromtmux capture-pane.Handles bare
SO/SI(0x0e/0x0f) ACS box-drawing runs without polluting the reconstructed terminal’s liveG1charset, expandsGRID_FLAG_TAB\tcells against#{pane_tabs}while preserving active SGR background/attributes, carries SGR across rows just liketmux’sgrid_string_cells(&gc), reconstructspending_wrapfromcursor_x >= pane_width, and optionally populates backgrounded primary history whenalternate_onis active.- Parameters:
captured (
CaptureInput) – Output oftmux capture-pane -S - -E - -e -p -N [-F]asstr,bytes, or a line sequence (e.g.libtmuxPane.capture_pane).metadata (
TmuxPaneMetadata|str|None) – ParsedTmuxPaneMetadataor raw format line emitted bydisplay-message -p TMUX_METADATA_FORMAT; whenNone, rows, cols, and scrollback defaults are used.rows (
int) – Fallback pane height when metadata isNone.cols (
int) – Fallback pane width when metadata isNone.scrollback (
int|None) – Explicit scrollback line cap; whenNone, defaults tometadata.history_limitif metadata is provided, else2000.flagged (
bool) –Truewhen captured includescapture-pane -Fline prefixes.joined_capture (
CaptureInput|None) – Optionalcapture-pane -S - -E - -e -p -Joutput used to infer soft wraps ontmux < 3.8whenflagged=False.saved_primary_capture (
CaptureInput|None) – Optionalcapture-pane -a -q -S - -E - -e -p -N [-F]output restoring the backgrounded primary screen and scrollback whenalternate_onisTrue.saved_primary_flagged (
bool|None) – Whether saved_primary_capture carries-Fprefixes (defaults to flagged).post_metadata (
TmuxPaneMetadata|str|None) – Optional second metadata sample taken immediately aftercapture-paneto verifypane_output_generationstability.profile (
Profile) – Compatibility profile for the reconstructed terminal.policy (
Policy) – Security policy for the reconstructed terminal.limits (
Limits) – Resource ceilings for the reconstructed terminal.
- Returns:
Reconstructed terminal, immutable snapshot, completeness report, and parsed per-line flags.
- Return type:
-
libvt.tmux.parse_flagged_line(line)¶libvt.tmux.parse_flagged_line(line)¶
Split a
tmux capture-pane -Fline into(flags, body).- Parameters:
line (
str) – Single line emitted bytmux capture-pane -F(without trailing\n).- Returns:
Parsed
TmuxLineFlagsand remaining SGR/text payload.- Return type:
- Raises:
ValueError– If line does not start with a valid<flags>space-delimited prefix.
-
libvt.tmux.unescape_tmux_control_output(data)¶libvt.tmux.unescape_tmux_control_output(data)¶
Decode
tmux -CC%outputoctal escapes into raw PTY bytes.tmuxcontrol mode escapes bytes< 0x20and backslash (0x5c->\134) as three-digit octal sequences\ooowhile passing printable ASCII and UTF-8 bytes verbatim (including split multi-byte UTF-8 sequences).- Parameters:
data (
collections.abc.Buffer|str) – Escaped payload following%output %<pane_id>.- Returns:
Unescaped raw VT byte stream ready for
feed().- Return type: