Repository navigation
Description
Summary
AsyncTerminalStream.wait_for() and PtySession.wait_for() evaluate str predicates via predicate in snap.text, where Snapshot.text joins every visual row with "\n" even when row.wrapped is True. When a child process writes a diagnostic message wider than the PTY width (such as an 86-column git authentication error on an 80-column PTY), DECAWM soft-wraps inside a word ("terminal prompts di" + "sabled") and await session.wait_for("terminal prompts disabled") fails with TerminalTimeoutError.
Reproduction
-
Feed an 86-column error line into an 80-column
AsyncTerminalStreamand wait for"terminal prompts disabled":$ uv run --no-sync python -c ' import asyncio from libvt import Terminal from libvt.aio import AsyncTerminalStream async def main() -> None: reader = asyncio.StreamReader() reader.feed_data(b"fatal: could not read Username for \x27http://127.0.0.1:44765\x27: terminal prompts disabled\r\n") reader.feed_eof() async with AsyncTerminalStream(reader, terminal=Terminal(rows=3, cols=80)) as stream: await stream.wait_for("terminal prompts disabled", timeout=0.2) asyncio.run(main()) '
Expected
wait_for("terminal prompts disabled") matches across the soft-wrapped continuation boundary (row.wrapped is True) while continuing to honor hard linebreaks (\r\n).
Actual
snap.text inserts "\n" inside "di\nsabled", raising TerminalTimeoutError:
libvt.exc.TerminalTimeoutError: Stream reached EOF before predicate matched (timeout=0.2s)
Environment
Versions
libvt:0.0.1a5(587227c)- Python:
3.15.1 - OS: Linux (
x86_64)
References
src/libvt/aio.py(v0.0.1a5, 587227c): https://github.com/tmux-python/libvt/blob/v0.0.1a5/src/libvt/aio.py#L1103-L1107 —AsyncTerminalStream.wait_for()checkspredicate in snap.textsrc/libvt/aio.py(v0.0.1a5, 587227c): https://github.com/tmux-python/libvt/blob/v0.0.1a5/src/libvt/aio.py#L1629-L1633 —PtySession.wait_for()checkspredicate in snap.textsrc/libvt/screen.py(v0.0.1a5, 587227c): https://github.com/tmux-python/libvt/blob/v0.0.1a5/src/libvt/screen.py#L875-L880 —format_rows_text()joins soft-wrapped rows with"\n"
Activity
tony commentedon Dec 3, 2026
In the local four-column replay the visible rows were
old,abcd, andef. The read model reported the logical linesoldandabcdef. A string wait can match the joined word, and a caller needing physical newlines can pass a predicate onsnap.text. Related PR #152