Skip to content

Docs(readme): Show how to read a window, session or pane again - #90

Open
tony wants to merge 1 commit into
masterfrom
docs-readme-refresh
Open

tony wants to merge 1 commit into
masterfrom
docs-readme-refresh

Conversation

@tony

@tony tony commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

What

Adds a "Window:snapshot: read one object again" section to the root README, after the snapshot and query sections. The old text only said to call Server:snapshot again. The section now says a record is what tmux said when it was read, that Lua has no refresh that updates a record in place like Python libtmux's .refresh(), and that snapshot on a handle (Window:snapshot, also Session:snapshot and Pane:snapshot) reads that one object again into a new record while the held record stays as it was.

The excerpt is the body of a new examples/api/refresh.lua: it reads a window, renames it with Window:rename, reads it again and prints editor build. The program is listed in examples/api/manifest.json with its stdout, which the README console block is checked against, and tests/tooling/test_api_examples.py counts it (10 programs) and its two targets.

Why

The maintainer asked for a plain refresh idiom in each port's README. Sibling PRs: libtmux/libtmux-ts#194, libtmux/libtmux-rs#137.

Checks

Toolchains were bootstrapped into the ignored .cache (bootstrap.py dev live, bootstrap_runtimes.py 5.4.9, bootstrap.py lint).

  • scripts/check.py mid: PASS in 5.5 s. That covers the 140 tooling tests, 359 Lua unit tests, StyLua Lua51, luacheck, generated-field drift, README examples and git diff --check. Its first runs caught a prose block over 240 characters and the missing manifest test update; both fixed.
  • sh examples/api/run.sh examples/api/refresh.lua with TMUX_BIN set to tmux 3.3a and to 3.8 builds: prints editor build on both. With the machine's tmux 3.8a it refuses with "topology operations require a supported exact tmux release", because 3.8a is not in the library's topology version table; that is existing behavior and not part of this PR.
  • Negative check: changing the manifest stdout to editor BROKEN made mid fail with "output differs from the manifest for examples/api/refresh.lua"; restored.
  • Links: the libtmux-window-snapshot, libtmux-window-rename, libtmux-pane-snapshot and libtmux-session-snapshot reference pages on libtmux.org return 200.
  • Not run: outer (owned-tmux integration, package builds, LuaLS).

Tool use: Claude Code, directed by the maintainer, wrote the change and ran the checks above.

why: Readers who know Python libtmux look for `.refresh()`. Lua has no
in-place refresh: a record is what tmux said when it was read, and
`snapshot` on a handle reads the object again into a new record. The
README only said to call `Server:snapshot` again.

what:
- Add a `Window:snapshot` section to the README that says Lua has no
  `refresh`, links `Window:snapshot`, `Session:snapshot`, `Pane:snapshot`
  and `Window:rename`, and quotes an excerpt with its console output
  (`README.md`)
- Add the `refresh` example, which renames a window and prints the held
  and the fresh names, and list it in the API example manifest
  (`examples/api/refresh.lua`, `examples/api/manifest.json`)
- Count the new example and its two targets in the manifest test
  (`tests/tooling/test_api_examples.py`)
@tony
tony deployed to docs-preview November 6, 2026 04:35 — with GitHub Actions Active

This branch was successfully deployed

1 active deployment
docs-preview — 13203a13 Deployed Nov 6, 2026 by tony via publish (pr-90, pr, false, docs-preview, true) / publish #336
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant