Skip to content

Accept strided terminal input buffers - #186

Merged
tony merged 3 commits into
masterfrom
fix/122-strided-buffers
Dec 5, 2026
Merged

tony merged 3 commits into
masterfrom
fix/122-strided-buffers

Conversation

@tony

@tony tony commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Closes #122

What changed, and why:

A sliced or reversed memoryview is read in logical byte order by the parser, terminal, recorder, and explainer. Terminal step offsets count those bytes.

Checks run:

On Linux, Ruff formatting and lint, ty for Python 3.12 through 3.15, the full pytest suite with doctests, compiled Ghostty comparisons, and the Sphinx warnings-as-errors build passed.

Tool use:

Codex prepared the change and ran the local checks. A separate Codex reviewer replayed the changed behavior and checked the publication tree against the reviewed patch.

tony added a commit that referenced this pull request Dec 3, 2026
why: Readers need the behavior and scope of this change at release.

what:
- Add the unreleased entry for PR #186
- Preserve previously published notes and the parent branch's entries
@tony
tony marked this pull request as ready for review December 3, 2026 01:59
@tony
tony force-pushed the fix/122-strided-buffers branch from e314d37 to df7e3ff Compare December 3, 2026 23:58
tony added 2 commits December 5, 2026 07:30
why: A non-contiguous buffer can carry a valid terminal byte stream.

what:
- Normalize buffer views for parser, terminal and recorder entry points.
- Preserve logical byte offsets and buffer ownership during callbacks.
- Exercise reversed, strided and multidimensional input.

Fixes #122
why: The logical order of a sliced or reversed memoryview can differ
     from its backing storage.

what:
- Document accepted input and the byte units used by step offsets.
@tony
tony force-pushed the fix/122-strided-buffers branch from df7e3ff to 0867cea Compare December 5, 2026 13:31
@tony
tony changed the base branch from master to fix/88-vt-checkpoint-state December 5, 2026 13:31
why: Empty multidimensional views raise TypeError on cast("B"), and
     sibling Buffer entry points in libvt.aio and
     libvt.contrib.tmux.control still called cast("B") directly.

what:
- Return a fresh memoryview(b"") when nbytes is 0 and release
  intermediate memoryviews in _byte_view().
- Reuse _byte_view() in PtySession._enqueue_write(),
  unescape_tmux_control_output(), and TmuxControlParser.feed().
- Add regression tests for strided, reversed, and empty
  multidimensional views across parser, terminal, aio, and tmux.
@tony
tony force-pushed the fix/122-strided-buffers branch from 0867cea to fec8aca Compare December 5, 2026 13:39
@tony
tony changed the base branch from fix/88-vt-checkpoint-state to master December 5, 2026 13:39
@tony
tony merged commit 859b2a9 into master Dec 5, 2026
9 checks passed
@tony tony mentioned this pull request Dec 5, 2026
35 of 38 tasks
@tony
tony deleted the fix/122-strided-buffers branch December 5, 2026 20:41

This branch was successfully deployed

1 active deployment
docs — fec8aca9 Deployed Dec 5, 2026 by tony via build (3.14) #418
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.

Define how the parser and terminal accept strided buffers

1 participant