Skip to content

Window(feat[vt]): Add multi-pane window VT capture - #939

Open
tony wants to merge 6 commits into
experiment/libvt-capture-metadatafrom
feat-933-vt-window
Open

tony wants to merge 6 commits into
experiment/libvt-capture-metadatafrom
feat-933-vt-window

Conversation

@tony

@tony tony commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Add Window.capture_vt() and capture_window_vt() to composite split windows into a Snapshot.
  • Add VtSessionObserver.snapshot_window() to composite live watched panes over control mode.
  • Add assert_window_screen() and assert_window_screen_box() for multi-pane layout and cursor checks.

Companion PR

Changes

  • src/libtmux/vt.py, src/libtmux/window.py: add capture_window_vt, Window.capture_vt, VtSessionObserver.snapshot_window, assert_window_screen, and assert_window_screen_box.
  • tests/test_vt.py: add split-pane, pane-border-status, zoom, error, and control-mode observer parity tests.
  • docs/api/libtmux.vt.md, CHANGES: add a tested 3-pane split window doctest and changelog notes.

Test plan

  • Formatting and lint checks pass via uv run ruff format . .github/scripts --check and uv run ruff check . .github/scripts
  • Static type checks pass on Python 3.11 and Python 3.15 via uv run ty check and uv run ty check --python-version 3.15
  • Split-pane capture, border status, zoom, doctests, and observer parity pass via uv run pytest tests/test_vt.py src/libtmux/vt.py src/libtmux/window.py docs/api/libtmux.vt.md --reruns=0
  • Documentation site builds cleanly via just build-docs
  • Full tmux 3.3a to master matrix in CI

@codecov

codecov Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.81818% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.08%. Comparing base (57d6169) to head (0f83e37).

Files with missing lines Patch % Lines
src/libtmux/vt.py 82.43% 7 Missing and 6 partials ⚠️
src/libtmux/window.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@                          Coverage Diff                          @@
##           experiment/libvt-capture-metadata     #939      +/-   ##
=====================================================================
+ Coverage                              62.88%   63.08%   +0.20%     
=====================================================================
  Files                                     30       30              
  Lines                                   5658     5735      +77     
  Branches                                1181     1197      +16     
=====================================================================
+ Hits                                    3558     3618      +60     
- Misses                                  1712     1723      +11     
- Partials                                 388      394       +6     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

tony added a commit to tmux-python/tmuxp that referenced this pull request Dec 1, 2026
why: tmux < 3.6 assigns odd remainder rows in layout_spread_cell to the
bottom split pane whereas tmux >= 3.6 assigns them to the top pane; an
8-row window gives 3 + 3 interior rows with zero remainder across all
tmux versions.

what:
- Size the dashboard PTY to 35x8 and refresh .ambr snapshots
- Point [tool.uv.sources] at the latest tmux-python/libtmux#939 tip
@tony tony added the area: observation Waits, capture, snapshots, subscriptions label Dec 5, 2026
@tony tony added this to the 0.73.0 milestone Dec 5, 2026
@tony
tony force-pushed the feat-933-vt-window branch from 6fc46db to 79d0946 Compare December 5, 2026 14:51
@tony
tony changed the base branch from feat-933-vt to experiment/libvt-capture-metadata December 5, 2026 16:45
@tony
tony force-pushed the feat-933-vt-window branch from 79d0946 to 7427135 Compare December 5, 2026 16:45
tony added a commit that referenced this pull request Dec 5, 2026
why: Record multi-pane Window.vt layout composition and borders.

what:
- Add unreleased 0.73.0 feature notes for #939.
@tony
tony force-pushed the experiment/libvt-capture-metadata branch from fb7be39 to f947716 Compare December 5, 2026 18:41
@tony
tony force-pushed the feat-933-vt-window branch from 7427135 to 8b2eedb Compare December 5, 2026 18:41
@tony
tony force-pushed the experiment/libvt-capture-metadata branch from f947716 to 57fe099 Compare December 5, 2026 22:53
tony added a commit that referenced this pull request Dec 5, 2026
why: Record multi-pane Window.vt layout composition and borders.

what:
- Add unreleased 0.73.0 feature notes for #939.
@tony
tony force-pushed the feat-933-vt-window branch from 8b2eedb to 9b32eb7 Compare December 5, 2026 22:53
tony added 6 commits December 5, 2026 20:23
why: Let callers capture split tmux windows into a single composited
Snapshot with dividers, junctions, border status labels, and cursor
coordinates, or composite watched panes over a live tmux -C observer.

what:
- Add capture_window_vt, Window.capture_vt, assert_window_screen, and
  assert_window_screen_box
- Add VtSessionObserver.snapshot_window over control mode
- Add split-pane, border-status, zoom, error, and observer parity tests
why: Show tested multi-pane Snapshot grids in the VT guide.

what:
- Add a 3-pane split window doctest to docs/api/libtmux.vt.md
why: Sending enter to every pane lets tmux reap the window before
win.kill() runs under faster scheduling.

what:
- Call win.kill() directly in test_window_capture_vt_splits_border_status_zoom_and_errors
why: libvt checks active-pane stability in WIN_POST, sizes 3.3a-3.5
border-status spans to wp.width - 4, and derives default parse profiles
from tmux_version.

what:
- Pass include_layout=True and forward profile directly in capture_window_vt
- Shorten pane 2 title to fit 3.3a-3.5 border-status width and test focus
  switches
why:
Writing CSI 2 J before Window.split fills the initial full-width row
with tmux GRID_FLAG_CLEARED spaces, causing grid_reflow_split to wrap
cleared trailing cells and push row 0 into scrollback if python writes
before split-window shrinks the pane.

what:
Omit redundant CSI 2 J / CSI H prefixes on freshly spawned split-window
doctest and test commands so row cellused matches visible text width.
why: Record multi-pane Window.vt layout composition and borders.

what:
- Add unreleased 0.73.0 feature notes for #939.
@tony
tony force-pushed the experiment/libvt-capture-metadata branch from 57fe099 to 57d6169 Compare December 6, 2026 02:23
@tony
tony force-pushed the feat-933-vt-window branch from 9b32eb7 to 0f83e37 Compare December 6, 2026 02:24
tony added a commit to tmux-python/tmuxp that referenced this pull request Dec 6, 2026
why: tmuxp #1121 consumes Window.capture_vt and VtSessionObserver window
capture APIs from tmux-python/libtmux#939, which now requires libvt
>=0.0.1a7,<0.1.

what:
- Pin libtmux in [tool.uv.sources] to 0f83e37c545787bf089047ade1357c4c1197b6d2
- Refresh uv.lock against libvt 0.0.1a7

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: observation Waits, capture, snapshots, subscriptions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant