Skip to content

Concept: Wait for a whole reply from a tmux pane - #153

Merged
tony merged 2 commits into
masterfrom
concept-read-pane-line
Dec 6, 2026
Merged

tony merged 2 commits into
masterfrom
concept-read-pane-line

Conversation

@tony

@tony tony commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

Try it

Open a line watch on the pane before sending sum 19 23. Once the calculator answers, the example prints result=42.

local reply, err = lines:next({ prefix = "result=", timeout = 5000 }):await()

Progress messages use up the same five seconds. If the wait expires halfway through an answer, the next read can finish it using the buffered partial line. A coverage gap or buffer overflow closes the watch with observation_gap. Runnable calculator · Line endings, limits and lost output

What changed

observation:watch_pane_lines(pane) reads complete lines on tmux 3.7 or newer. Give it a prefix your application reserves for replies. The line watch joins split output events and gives large joins a fresh dispatch turn so ready callbacks can run. A separate byte watch still sees the original bytes.

The line watch uses the request and byte-watch deadline handling in #169. The long-line test checks that a ready callback can run before a large reply is joined.

Test plan

  • Run the full outer gate with Lua 5.5.1, tmux 3.8 and Neovim 0.12.5 on Linux ARM64 (68 s).
  • Exercise split records, timeout and retry, cancellation, long-line fairness and raw-watch order.
  • Run observation and control integrations on tmux 3.7 with Lua 5.1.5 and Neovim 0.10.0. Check refusal at tmux 3.3a.
  • Verify GitHub’s required CI when this PR reaches master. The byte-watch fix in #169 has merged.

Closes #152. Related to #136.

@tony tony added enhancement New feature or request lua Pull requests that update Lua code area:core Shared Lua library values, operations, and behavior across runtime adapters. p2 Scoped runtime defects, compatibility gaps, or enabling improvements. topic:api Public Lua types, methods, error contracts and discoverability. topic:control-mode tmux control connections, command replies and pane output streams. topic:timeouts Deadline semantics, polling intervals and bounded waits. labels Dec 5, 2026
@tony
tony deployed to docs-preview December 5, 2026 01:58 — with GitHub Actions Active
@tony
tony changed the base branch from master to qa/queued-deadline December 5, 2026 18:02
@tony
tony force-pushed the concept-read-pane-line branch from 0335ef0 to 26083e3 Compare December 5, 2026 18:02
@tony
tony force-pushed the qa/queued-deadline branch from 0ef1670 to 9c6aa5b Compare December 6, 2026 01:50
@tony
tony force-pushed the concept-read-pane-line branch from 26083e3 to 48b0380 Compare December 6, 2026 02:07
@tony
tony force-pushed the qa/queued-deadline branch from 9c6aa5b to 5df4084 Compare December 6, 2026 02:07
tony added 2 commits December 6, 2026 08:35
why:
tmux can split an answer across output events. One reply can also span
enough bytes to delay other callbacks while the watch frames it.

what:
- Wait for a complete line under a single deadline and optional prefix.
- Keep partial and unread lines after timeout or cancellation.
- Give long joins a fresh dispatch slice and preserve the raw watch.
why:
Readers need a way to find the complete-line reply API.

what:
- Mention reply prefixes and deadlines under Unreleased.
@tony
tony changed the base branch from qa/queued-deadline to concept-calculator-quickstart December 6, 2026 14:35
@tony
tony force-pushed the concept-calculator-quickstart branch from 26801f4 to ae13fa5 Compare December 6, 2026 14:35
@tony
tony force-pushed the concept-read-pane-line branch from 48b0380 to 751fee9 Compare December 6, 2026 14:35
@tony
tony changed the base branch from concept-calculator-quickstart to master December 6, 2026 14:52
@tony
tony marked this pull request as ready for review December 6, 2026 14:52
@tony
tony merged commit 647063e into master Dec 6, 2026
12 checks passed
@tony
tony deleted the concept-read-pane-line branch December 6, 2026 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:core Shared Lua library values, operations, and behavior across runtime adapters. enhancement New feature or request lua Pull requests that update Lua code p2 Scoped runtime defects, compatibility gaps, or enabling improvements. topic:api Public Lua types, methods, error contracts and discoverability. topic:control-mode tmux control connections, command replies and pane output streams. topic:timeouts Deadline semantics, polling intervals and bounded waits.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wait for a complete reply line from a tmux pane

1 participant