# Changelog

## libvt 0.0.1a5 (Yet to be released)

<!-- KEEP THIS PLACEHOLDER - DO NOT REMOVE OR MODIFY THIS LINE -->
_Notes on the upcoming release will go here._
<!-- END PLACEHOLDER - ADD NEW CHANGELOG ENTRIES BELOW THIS LINE -->

## libvt 0.0.1a4 (2026-11-29)

`libvt` 0.0.1a4 adds tool-agnostic boxed VT and `SGR` snapshot serialization,
regime-aware dynamic-value scrubbing, and compact failure diffs in core
{mod}`libvt.testing` ({func}`~libvt.testing.serialize_vt_snapshot`,
{func}`~libvt.testing.vt_screen`, and
{func}`~libvt.testing.format_vt_diff_lines`) with zero runtime dependencies. It
also adds optional `libvt[pytest]` and `libvt[syrupy]` extras, pairing
{mod}`libvt.pytest_plugin` fixtures with {mod}`libvt.contrib.syrupy`'s
{class}`~libvt.contrib.syrupy.VtSnapshotExtension` and conditional
{fixture}`vt_snapshot` `.ambr` fixture. See {ref}`topics-snapshots` and
{ref}`topics-testing` for details and runnable examples.

### What's new

#### `libvt.testing`: Boxed VT and `SGR` snapshot serialization (#66, #67)

{func}`~libvt.testing.serialize_vt_snapshot`,
{func}`~libvt.testing.vt_screen` ({class}`~libvt.testing.VtScreenView`), and
{func}`~libvt.testing.format_vt_diff_lines` serialize terminal screens,
snapshots, region slices, `tmux` captures, and duck-typed pane objects into
escape-free Unicode viewport boxes with run-length `styles:` spans,
regime-aware regex scrubbing, and TTY or ASCII-caret failure diffs with no
runtime or snapshot-tool dependencies. See {ref}`topics-snapshots` and
{ref}`topics-testing` for details.

#### `libvt.pytest_plugin`: Fixture documentation and `libvt[pytest]` extra (#66, #67)

Install `libvt[pytest]` for {mod}`libvt.pytest_plugin`'s {fixture}`vt_terminal`,
{fixture}`vt_factory`, {fixture}`vt_recorder`, {fixture}`vt_parser`, and
{fixture}`vt_pty` fixtures while keeping core `libvt` runtime `dependencies`
empty and {mod}`libvt.pytest_plugin` free of third-party snapshot-tool
dependencies.

#### `libvt.contrib.syrupy`: Optional `.ambr` adapter and conditional `vt_snapshot` fixture (#66, #67)

Install `libvt[syrupy]` for `.ambr` golden-file testing.
{class}`~libvt.contrib.syrupy.VtSnapshotExtension` adapts {mod}`libvt.testing`
to `syrupy`, and `libvt_syrupy` registers {fixture}`vt_snapshot` automatically
when `syrupy` is active in `pytest` while omitting it from `pytest --fixtures`
when `syrupy` is uninstalled or disabled (`-p no:syrupy`).

### Development

CI runs ty on the terminal package, test suite and development scripts at the supported Python targets. ([#70](https://github.com/tmux-python/libvt/pull/70))

## libvt 0.0.1a3 (2026-11-29)

`libvt` 0.0.1a3 adds mode-40-gated `80`/`132`-column switching
({class}`~libvt.config.DeccolmBehavior`), `IBM PC` / `CP437` (`'U'`) graphic
charset designations, and opt-in ISO-2022 `DOCS` wire-encoding transitions for
legacy terminal streams. It also adds column-padded `display_lines` export and
stateless {meth}`Snapshot.viewport <libvt.terminal.Snapshot.viewport>`
scrollback paging, and expands {mod}`libvt.contrib.tmux` with
cursor/keypad/key-mode metadata, bounded `history_lines` capture,
`%layout-change` resizing, and in-place
{meth}`TmuxPaneSync.resync <libvt.contrib.tmux.control.TmuxPaneSync.resync>`.
See {ref}`topics-migrating-from-pyte` for migration details and runnable
examples.

### What's new

#### Mode-gated 80/132-column switching, `CP437` charset, and wire-encoding transitions (#58)

{class}`~libvt.modes.Mode` adds {attr}`~libvt.modes.Mode.DECCOLM` (`?3`),
{attr}`~libvt.modes.Mode.ALLOW_80_132` (`?40`), and
{attr}`~libvt.modes.Mode.DECNCSM` (`?95`), governed by
{attr}`ScreenBehavior.deccolm <libvt.config.ScreenBehavior.deccolm>`
({class}`~libvt.config.DeccolmBehavior`).
{data}`~libvt.config.DEFAULT_PROFILE` uses
{attr}`~libvt.config.DeccolmBehavior.GATED_BY_MODE_40` with `?40` initially
reset (`?3h` selects `132` columns and `?3l` selects `80` columns once `?40h`
is enabled), {func}`~libvt.contrib.tmux.profile.tmux_profile` uses
{attr}`~libvt.config.DeccolmBehavior.CLEAR_ONLY` so `tmux` retains
authoritative pane geometry, and {data}`~libvt.profiles.LINUX_CONSOLE_PROFILE`
uses {attr}`~libvt.config.DeccolmBehavior.IGNORE`.

`G0`–`G3` character-set designations ({type}`~libvt.config.Charset`) add `'U'`
(`IBM PC` / `CP437` `0xA0`–`0xFF` graphic mapping in `"latin-1"` parser mode).
{class}`~libvt.parser.Parser` adds {meth}`~libvt.parser.Parser.set_encoding`
and `allow_encoding_switch`, wired to
{attr}`ScreenBehavior.allow_encoding_switch <libvt.config.ScreenBehavior.allow_encoding_switch>`
(`False` by default; `True` on {data}`~libvt.profiles.LINUX_CONSOLE_PROFILE`)
for ISO-2022 `DOCS` (`ESC % G` / `ESC % @`) transitions,
{func}`~libvt.codec.explain` disassembles `ESC % G` and `ESC % @`, and
{meth}`Terminal.feed_str <libvt.terminal.Terminal.feed_str>` raises
{exc}`ValueError` when the wire encoding is `"latin-1"`.

#### Full-width display export and stateless snapshot history viewports (#59)

{class}`~libvt.terminal.Terminal`, {class}`~libvt.terminal.Snapshot`,
{class}`~libvt.screen.Screen`, and {class}`~libvt.screen.RegionView` add
`display_lines` (paired with
{attr}`RowView.display_text <libvt.screen.RowView.display_text>`) returning
visible rows padded with trailing spaces to exact terminal-column width while
replacing wide glyphs clipped at slice boundaries with `" "`.
{meth}`Snapshot.viewport <libvt.terminal.Snapshot.viewport>` returns an
immutable `(rows, cols)` {class}`~libvt.screen.RegionView` shifted upward into
retained primary scrollback by `offset` rows without mutating live terminal
state or blending primary history into alternate-screen snapshots. See
{ref}`topics-migrating-from-pyte` for details.

#### Extended `tmux` pane metadata, layout resize, and in-place resync (#60)

{data}`~libvt.contrib.tmux.capture.TMUX_METADATA_FORMAT` and
{class}`~libvt.contrib.tmux.capture.TmuxPaneMetadata` capture `cursor_shape`,
`cursor_blinking`, `keypad_flag`, and `modify_other_keys` (`pane_key_mode`);
{class}`~libvt.contrib.tmux.capture.TmuxCaptureResult` exposes `metadata` and
`post_metadata`; {func}`~libvt.contrib.tmux.capture.build_tmux_capture_command`,
{func}`~libvt.contrib.tmux.capture.decode_tmux_capture`, and
{class}`~libvt.contrib.tmux.control.TmuxPaneSync` accept bounded `history_lines`
(`-S 0` / `-S -N`) and enable `capture-pane -F` on `tmux >= 3.7` (with
{func}`~libvt.contrib.tmux.profile.parse_tmux_version` accepting `"master"` and
`-<suffix>` tags). `TmuxPaneSync` resizes live panes from V1 and V2 JSON
`%layout-change` notifications and adds
{meth}`~libvt.contrib.tmux.control.TmuxPaneSync.resync` (also triggered on
`%pause` / `%continue` recovery) updating `sync.terminal` in place while
advancing its epoch for {class}`~libvt.terminal.SyncToken` consumers.

### Documentation

- Expand {ref}`topics-migrating-from-pyte` with a `pyte` compatibility matrix,
  documented omissions, and runnable doctests for coordinate indexing, legacy
  encodings, `display_lines`, {meth}`~libvt.terminal.Snapshot.viewport` paging,
  dirty-row deltas, query replies, and `tmux` observation (#59).

## libvt 0.0.1a2 (2026-11-28)

`libvt` 0.0.1a2 splits {class}`~libvt.config.Profile` into capability groups
with {mod}`libvt.profiles` host presets, moves `tmux` support into decoupled
{mod}`libvt.contrib.tmux` submodules (adding
{class}`~libvt.contrib.tmux.control.TmuxControlParser` and sans-I/O
{class}`~libvt.contrib.tmux.control.TmuxPaneSync`), and narrows top-level
{mod}`libvt` behind lazy PEP 562 imports. It also converts
{class}`~libvt.events.Event` to an open base class with `OSC 633` shell
integration and `OSC 9`/`99`/`777` {class}`~libvt.events.Notification` events,
holds {attr}`Snapshot.appearance <libvt.terminal.Snapshot.appearance>` across
`?2026` redraws, adds stateful `XTSMGRAPHICS`, `XTSAVE`/`XTRESTORE`, Kitty
alternate-key and associated-text encoding, and bidirectional
{class}`~libvt.aio.AsyncSession` writes, and certifies `PyPy 3.12` in CI. See
{doc}`topics/protocols-and-input`, {doc}`topics/sync-and-asyncio`, and
{doc}`migration` for upgrade details.

### Breaking changes

#### Curated PEP 562 `libvt` root namespace (#43)

Top-level {mod}`libvt` narrows `libvt.__all__` to a curated quickstart surface
({class}`~libvt.style.Appearance`, {class}`~libvt.screen.Cell`,
{class}`~libvt.events.Event`, {exc}`~libvt.exc.LibVtError`,
{class}`~libvt.config.Limits`, {class}`~libvt.config.Policy`,
{class}`~libvt.config.Profile`, {exc}`~libvt.exc.ProtocolError`,
{class}`~libvt.screen.Screen`, {class}`~libvt.terminal.Snapshot`,
{class}`~libvt.style.Style`, {class}`~libvt.terminal.Terminal`, `__version__`,
{func}`~libvt.terminal.render`, and {func}`~libvt.terminal.strip`) resolved
lazily via PEP 562 so `import libvt` and `pytest11` plugin discovery do not load
emulator modules or Unicode lookup tables. Import specialized classes and
helpers from their owning submodules:

```python
# Before
from libvt import AnsiColor, KeyEvent, Mode, Parser, explain

# After
from libvt.codec import explain
from libvt.input import KeyEvent
from libvt.modes import Mode
from libvt.parser import Parser
from libvt.style import AnsiColor
```

#### Passive-observer `Policy.emit_replies` and `ClipboardReadPolicy` (#40)

{class}`~libvt.config.Policy` removes `allow_checksum_report` and replaces
`allow_clipboard_read: bool` with
{attr}`~libvt.config.Policy.clipboard_read`
({class}`~libvt.config.ClipboardReadPolicy`, defaulting to
{attr}`~libvt.config.ClipboardReadPolicy.IGNORE`):

```python
# Before
from libvt.config import Policy

pol = Policy(allow_clipboard_read=True)

# After
from libvt.config import ClipboardReadPolicy, Policy

pol = Policy(clipboard_read=ClipboardReadPolicy.EMIT_EVENT)
```

#### Decoupled `libvt.contrib.tmux` submodules and core `tmux` removal (#39)

`libvt.tmux`, `Terminal.from_tmux_capture()`, `Snapshot.from_tmux_capture()`,
`Profile.tmux()`, {data}`~libvt.contrib.tmux.profile.TMUX_PROFILE`, and
{data}`~libvt.contrib.tmux.profile.TMUX_CAPTURE_POLICY` move into
decoupled {mod}`libvt.contrib.tmux` submodules
({mod}`libvt.contrib.tmux.profile`, {mod}`libvt.contrib.tmux.capture`, and
{mod}`libvt.contrib.tmux.control`) with {func}`~libvt.contrib.tmux.profile.tmux_profile`
accepting `sixel` and `clipboard` `DA1` flags:

```python
# Before
from libvt import TMUX_PROFILE, Terminal

term = Terminal.from_tmux_capture(lines, metadata=meta)

# After
from libvt.contrib.tmux.capture import decode_tmux_capture
from libvt.contrib.tmux.profile import TMUX_PROFILE, tmux_profile

term = decode_tmux_capture(lines, metadata=meta).terminal
```

#### Open `Event` base class and consolidated `TitleChanged` (#38)

{class}`~libvt.events.Event` is now an open keyword-only base class
(`kw_only=True, match_args=False`) rather than a closed union alias,
`WindowRenamed` folds into {class}`~libvt.events.TitleChanged` with
{class}`~libvt.events.TitleTarget`
({attr}`~libvt.events.TitleTarget.TMUX_WINDOW_NAME`), and
{class}`~libvt.events.WorkingDirectoryChanged` adds a
{attr}`~libvt.events.WorkingDirectoryChanged.source`
({class}`~libvt.events.CwdSource`) discriminator. Import
{type}`~libvt.events.KnownEvent` when static exhaustiveness over built-in core
events is required:

```python
# Before
from libvt.events import TitleChanged, WindowRenamed

match ev:
    case WindowRenamed(name):
        ...
    case TitleChanged(title):
        ...

# After
from libvt.events import TitleChanged, TitleTarget

match ev:
    case TitleChanged(title=name, target=TitleTarget.TMUX_WINDOW_NAME):
        ...
    case TitleChanged(title=title):
        ...
```

#### Capability-grouped `Profile` and `libvt.profiles` host presets (#37)

{class}`~libvt.config.Profile` replaces its flat attributes with frozen,
hashable capability dataclasses ({class}`~libvt.config.Identity`,
{class}`~libvt.config.QueryBehavior`, {class}`~libvt.config.ScreenBehavior`,
{class}`~libvt.config.InputBehavior`, and
{class}`~libvt.config.UnicodeBehavior`), and moves host-terminal presets
({data}`~libvt.profiles.XTERM_PROFILE` and
{data}`~libvt.profiles.LINUX_CONSOLE_PROFILE`, joined by
{data}`~libvt.profiles.GHOSTTY_PROFILE` and
{data}`~libvt.profiles.KITTY_PROFILE`) into {mod}`libvt.profiles`:

```python
# Before
from libvt.config import LINUX_CONSOLE_PROFILE, Profile

prof = Profile(reflow_on_resize=False, cursor_rgb=(1, 2, 3))

# After
from libvt.config import Profile, QueryBehavior, ScreenBehavior
from libvt.profiles import LINUX_CONSOLE_PROFILE

prof = Profile(
    queries=QueryBehavior(cursor_rgb=(1, 2, 3)),
    screen=ScreenBehavior(reflow_on_resize=False),
)
```

### What's new

#### `tmux` control-mode byte parser and sans-I/O pane sync (#27)

{mod}`libvt.contrib.tmux.control` adds
{class}`~libvt.contrib.tmux.control.TmuxControlParser` (streaming raw-byte
framing for `tmux -C` / `-CC` `%begin`/`%end`/`%error` command blocks,
`%output` / `%extended-output` octal payloads without split-UTF-8 loss,
`%pause`/`%continue`, `%layout-change`, `%subscription-changed`, and `%exit`
into {type}`~libvt.contrib.tmux.control.TmuxControlEvent` records) and
{class}`~libvt.contrib.tmux.control.TmuxPaneSync` (sans-I/O two-phase
`refresh-client -A '%N:pause'` barrier + atomic `capture-pane` /
`capture-pane -P -p -C` / `refresh-client -A '%N:continue'` handoff into live
`%output` streaming). See {ref}`topics-sync-and-asyncio` for details.

#### Desktop notifications for `OSC 9`, Kitty `OSC 99`, and `OSC 777` (#31)

{class}`~libvt.terminal.Terminal` parses iTerm2 `OSC 9` (filtering ConEmu
`9;1`–`9;12` subcommands), chunked Kitty `OSC 99` (`d=0`/`d=1`, `e=0`/`e=1`
Base64, `p=title`/`p=body`/`p=?`, `u=0..2`), and rxvt `OSC 777 ; notify`
sequences into sanitized {class}`~libvt.events.Notification` events
({class}`~libvt.events.NotificationSource`,
{class}`~libvt.events.NotificationUrgency`, included in
{type}`~libvt.events.KnownEvent`), gated on
{attr}`~libvt.config.Policy.allow_notifications`,
{attr}`~libvt.config.Policy.allow_notification_queries`,
{attr}`~libvt.config.Limits.max_pending_notifications`, and
{attr}`~libvt.config.Limits.max_notification_bytes`.

#### Stateful `XTSMGRAPHICS` color and geometry registers (#28)

{class}`~libvt.terminal.Terminal` implements stateful `XTSMGRAPHICS`
(`CSI ? Pi ; Pa ; Pv S`) `SIXEL` color-register (`Pi = 1`) and pixel-geometry
(`Pi = 2`) read, reset, set, and maximum queries (`Pa = 1..4`) gated on
{attr}`~libvt.config.Policy.track_graphics` and
{class}`~libvt.config.QueryBehavior`
({attr}`~libvt.config.QueryBehavior.xtsmgraphics_enabled`,
{attr}`~libvt.config.QueryBehavior.xtsmgraphics_geometry_enabled`,
{attr}`~libvt.config.QueryBehavior.xtsmgraphics_set_enabled`,
{attr}`~libvt.config.QueryBehavior.sixel_color_registers`, and
{attr}`~libvt.config.QueryBehavior.max_sixel_color_registers`), with host
presets in {mod}`libvt.profiles` and
{func}`~libvt.contrib.tmux.profile.tmux_profile` configured to match upstream
terminal behavior.

#### Kitty alternate keys and associated text (#30)

{class}`~libvt.input.KeyEvent` adds optional single-character
{attr}`~libvt.input.KeyEvent.shifted_key` and
{attr}`~libvt.input.KeyEvent.base_key` fields (with US-ASCII shifted keys
populated by {meth}`~libvt.input.KeyEvent.parse`), and
{func}`~libvt.input.encode_input` formats Kitty keyboard protocol flags
{attr}`~libvt.input.KittyKeyboardFlags.REPORT_ALTERNATE_KEYS` (`4`) and
{attr}`~libvt.input.KittyKeyboardFlags.REPORT_ASSOCIATED_TEXT` (`16`) into
`CSI key[:shifted[:base]] ; [mods[:event]] ; [text-codepoints] u` sequences.

#### `PyPy 3.12` CI certification and `TerminalTimeoutError` reduction fix (#32)

{exc}`~libvt.exc.TerminalTimeoutError` preserves `errno`, `strerror`, and
filenames across `pickle` protocols `0`–`5` when `args` is replaced with a
custom two-element tuple, and CI certifies `PyPy 3.12` (`UV_PYTHON=pypy@3.12`)
across `array('Q')` / `memoryview` rows, moving-GC cycles, and JIT throughput
benchmarks.

#### `XTSAVE`/`XTRESTORE`, legacy input modes, and `AsyncSession` (#29, #42)

{class}`~libvt.terminal.Terminal` implements `XTSAVE` (`CSI ? Pm s`) and
`XTRESTORE` (`CSI ? Pm r`) single-slot DEC private mode save/restore (gated on
{attr}`~libvt.config.ScreenBehavior.xtsave_enabled`), plus DEC modes `?8`
({attr}`~libvt.modes.Mode.AUTO_REPEAT`), `?66`
({attr}`~libvt.modes.Mode.APPLICATION_KEYPAD`, reconciled with `ESC =` /
`ESC >`), and `?67` ({attr}`~libvt.modes.Mode.BACKARROW_IS_BS`).
{class}`~libvt.input.MouseTracker` deduplicates same-cell `?1002` drag motion
outside stateless {meth}`~libvt.terminal.Terminal.encode`, and
{class}`~libvt.aio.AsyncTerminalStream` adds non-blocking outbound
{meth}`~libvt.aio.AsyncTerminalStream.send`,
{meth}`~libvt.aio.AsyncTerminalStream.send_event`,
{meth}`~libvt.aio.AsyncTerminalStream.send_key`,
{meth}`~libvt.aio.AsyncTerminalStream.paste`,
{meth}`~libvt.aio.AsyncTerminalStream.drain`, and
{meth}`~libvt.aio.AsyncTerminalStream.write_eof` methods under the shared
{class}`~libvt.aio.AsyncSession` protocol.

#### Committed `Snapshot.appearance`, `set_theme()`, and `DECSCNM` (`?5`) (#41)

{class}`~libvt.style.Appearance` captures active color scheme, default
foreground/background/cursor RGBs, `OSC 4` palette overrides, and DEC mode `?5`
({attr}`~libvt.modes.Mode.DECSCNM`) reverse video on
{attr}`~libvt.terminal.Snapshot.appearance` and
{attr}`~libvt.terminal.ScreenDelta.appearance_changed`, held atomically across
`?2026` synchronized updates and rendered in {class}`~libvt.terminal.Formatter`
HTML and VT output. {meth}`~libvt.terminal.Terminal.set_theme` updates host
theme defaults without clobbering guest `OSC 4` / `OSC 10`–`12` overrides and
emits `CSI ? 997 ; Ps n` when `?2031`
({attr}`~libvt.modes.Mode.COLOR_SCHEME_UPDATES`) is enabled.

#### Passive observer policy, `OSC 52` read events, and `at_ground_state` (#40)

{attr}`~libvt.config.Policy.emit_replies` (paired with
{data}`~libvt.contrib.tmux.profile.TMUX_OBSERVER_POLICY`) suppresses automatic
query and notification response bytes on passive observer streams without
mutating screen or event behavior. `OSC 52 ; <sel> ; ?` emits
{class}`~libvt.events.ClipboardReadRequested` under
{attr}`~libvt.config.ClipboardReadPolicy.EMIT_EVENT` for explicit responses via
{meth}`~libvt.terminal.Terminal.enqueue_reply`, and
{attr}`~libvt.parser.Parser.at_ground_state` /
{attr}`~libvt.terminal.Terminal.at_ground_state` report safe stream-splicing
boundaries.

#### `OSC 633` shell integration and dual `133`/`633` prompt deduplication (#38)

{class}`~libvt.terminal.Terminal` normalizes VS Code `OSC 633` markers (`A`–`D`
into {class}`~libvt.events.PromptZone` and {class}`~libvt.events.PromptMark`,
deduplicating same-cell `OSC 133` + `OSC 633` emissions while backfilling exit
codes; `633 ; E` into {class}`~libvt.events.ShellCommandReported`; and
`633 ; P` into {class}`~libvt.events.WorkingDirectoryChanged` or
{class}`~libvt.events.ShellPropertyChanged`). See
{doc}`topics/protocols-and-input` for details.

#### East Asian Ambiguous width and alternate-screen `RIS` axes (#37)

{attr}`~libvt.config.UnicodeBehavior.ambiguous_width` configures Unicode
`East_Asian_Width=A` characters (`1` cell by default, `2` cells for CJK legacy
layouts while keeping `U+FFFD` at width `1`), and
{attr}`~libvt.config.ScreenBehavior.ris_alt_screen` lets profiles preserve an
active alternate screen and saved primary buffer across `RIS` (`ESC c`).

## libvt 0.0.1a1 (2026-11-24)

`libvt` 0.0.1a1 adds `OSC 4` and `OSC 10`–`12` palette and dynamic color
queries, `XTMODKEYS` and `?1007` alternate-scroll input encoding,
cell-calibrated `?1016` pixel mouse coordinates, and chained `tmux` capture
bundles (`-N -T -F`). It also buffers outbound POSIX PTY writes above kernel
`TTYHOG` limits, expires stalled `?2026` holds on `EOF` and close, retains
`SIXEL` and Kitty graphics across `DECSTBM` scrolls and resize reflow, and
isolates per-terminal {class}`~libvt.terminal.SyncToken` watermarks. See
{doc}`topics/protocols-and-input`, {doc}`topics/sync-and-asyncio`, and
{doc}`migration` for upgrade details.

### Breaking changes

#### Cell-calibrated `MouseEvent.pixel_x` and `pixel_y` defaults (#26)

{attr}`~libvt.input.MouseEvent.pixel_x` and
{attr}`~libvt.input.MouseEvent.pixel_y` now default to `None`
(`int | None = None`) instead of `0` so `?1016` SGR-Pixel encoding derives
cell-center pixel coordinates from `row`, `col`, and
{class}`~libvt.config.Profile` cell geometry unless explicit pixel coordinates
are supplied:

```python
# Before
ev = MouseEvent(button=MouseButton.LEFT, action=MouseAction.PRESS, row=2, col=3)
assert (ev.pixel_x, ev.pixel_y) == (0, 0)

# After
ev = MouseEvent(button=MouseButton.LEFT, action=MouseAction.PRESS, row=2, col=3)
assert (ev.pixel_x, ev.pixel_y) == (None, None)  # encodes cell center (28, 40)
```

#### Scoped `CSI 5:3 m` overline decoding (#18)

{func}`~libvt.parser.parse_sgr` and live {meth}`~libvt.terminal.Terminal.feed`
ignore `CSI 5:3 m` (`5` with colon subparameter `3`, neither enabling overline
nor blink), matching `tmux` and `Ghostty` input parsing, while
{func}`~libvt.tmux.decode_tmux_capture` continues decoding `tmux`
`grid_string_cells_code`'s `5:3m` overline serialization:

```python
# Before
style = parse_sgr(CsiParams((5, 3), colon_mask=0b10))  # overline=True

# After
style = parse_sgr(CsiParams((53,)))  # standard SGR 53 overline
res = decode_tmux_capture(["\x1b[5:3mOV\x1b[0m"], rows=1, cols=4)
```

#### Opaque per-terminal sync watermarks (#22)

{class}`~libvt.terminal.SyncToken` keeps its watermark state private, disallows
direct instantiation, and renders a compact `repr()`. Read snapshot state from
{attr}`~libvt.terminal.ScreenDelta.snapshot` rather than inspecting token
attributes directly:

```python
# Before
cur = tok.cursor

# After
delta = term.changes_since(tok)
cur = delta.snapshot.cursor
```

### What's new

#### `OSC 4`/`12` queries, `XTMODKEYS`, `?1007`, and pixel `?1016` (#26)

{class}`~libvt.terminal.Terminal` answers `OSC 4` / `OSC 104` 256-palette
overrides and queries, semicolon-chained `OSC 10`–`12` / `OSC 110`–`112`
foreground, background, and cursor color queries
({attr}`~libvt.config.Profile.cursor_rgb`), `DECRQM` across all ANSI and DEC
modes, `XTSMGRAPHICS` (`CSI ? Pi ; Pa ; Pv S` returning `\x1b[?{pi};3S`), and
`XTMODKEYS` (`CSI > 4 ; pv m` and `CSI ? 4 m` via
{attr}`~libvt.terminal.Terminal.modify_other_keys` and
{attr}`~libvt.screen.Screen.modify_other_keys`), while consuming `OSC 9`,
`OSC 99`, and `OSC 777` notifications silently.
{func}`~libvt.input.encode_input` and {meth}`~libvt.terminal.Terminal.encode`
encode `XTMODKEYS` levels `1` and `2`, default-enabled `?1007`
({attr}`~libvt.modes.Mode.ALTERNATE_SCROLL`) wheel-to-arrow presses on the
alternate screen, and cell-calibrated `?1016`
({attr}`~libvt.input.MouseEvent.pixel_x` /
{attr}`~libvt.input.MouseEvent.pixel_y`) mouse coordinates, while
{meth}`~libvt.terminal.Terminal.resize`, {func}`~libvt.aio.open_pty`, and
{meth}`~libvt.aio.PtySession.resize` report pixel dimensions in `?2048` and
`TIOCSWINSZ`.

#### Chained `tmux` capture bundles and `-N -T -F` wide-wrap decoding (#18)

{func}`~libvt.tmux.build_tmux_capture_command` and
{class}`~libvt.tmux.TmuxCaptureCommand` construct single-invocation `tmux`
command chains bracketing `capture-pane -S - -E - -e -p -N -T -F` (`-e -p -N
-T` + `-e -p -J` on `3.4`–`3.7`, `-e -p -N` + `-e -p -J` on `3.3a`) with
`display-message` metadata headers and footers so pane output cannot drift
mid-capture and trailing blank viewport lines survive line-splitting wrappers.
{func}`~libvt.tmux.decode_tmux_capture`,
{meth}`~libvt.terminal.Terminal.from_tmux_capture`, and
{meth}`~libvt.terminal.Snapshot.from_tmux_capture` accept `trim_trailing=True`
to preserve explicit trailing spaces and disambiguate `GRID_FLAG_PADDING`
wide-wrap spacers in a single pass.

### Fixes

#### `BCE` hyperlinks, `SU` scrollback, `DEL` UTF-8 flush, and profiles (#25)

{class}`~libvt.terminal.Terminal` strips `OSC 8` hyperlinks from `BCE` blank
fills, pushes primary-screen `SU` (`CSI Ps S`) lines into scrollback when
unbounded horizontally, ignores non-`m` `CSI` sequences carrying `:`
subparameters while restricting {func}`~libvt.parser.parse_sgr` colons to
well-formed `4`/`38`/`48`/`58` groups, and flushes incomplete multi-byte UTF-8
sequences on `0x7F` (`DEL`) in {class}`~libvt.parser.Parser`. `DECSLRM` partial
scrolls preserve wide glyphs wholly inside `[left, right]`, and
{class}`~libvt.terminal.Formatter` restores `IRM`, `DECOM`, `DECLRMM`, and
`DECSCUSR` after rendering cells while padding `wrapped=True` rows to `cols`.
{class}`~libvt.config.Profile` splits {data}`~libvt.config.DEFAULT_PROFILE` and
{data}`~libvt.profiles.XTERM_PROFILE` (VT510 `DECSTR` mode set, shared primary
`DECSC`/`?1049h` save slot with isolated alternate `DECSC` slot, and
`SS2`/`SS3` single-shift preservation) from {data}`~libvt.config.TMUX_PROFILE`
({attr}`~libvt.config.Profile.declrmm_enabled` `False` so `CSI 5;10 s` saves
the cursor, {attr}`~libvt.config.Profile.top_margin_scrolls_to_history` `True`,
and {attr}`~libvt.config.Profile.separate_alt_save_cursor` `True`).

#### Buffered PTY writes, `?2026` EOF expiry, and frame-commit wakeups (#24)

{class}`~libvt.aio.PtySession` queues synchronous
{meth}`~libvt.aio.PtySession.send`, {meth}`~libvt.aio.PtySession.paste`, and
terminal query auto-replies onto a single bounded FIFO drained via
`loop.add_writer` with {meth}`~libvt.aio.PtySession.drain` high-water
backpressure, keeping bracketed pastes atomic above kernel `TTYHOG` limits
while flushing `?2048` replies inside {meth}`~libvt.aio.PtySession.resize` and
closing `master_fd` inside non-awaiting `finally` guards.
{class}`~libvt.aio.AsyncTerminalStream` and {class}`~libvt.aio.PtySession`
drive {meth}`~libvt.aio.AsyncTerminalStream.wait_for` and
{meth}`~libvt.aio.PtySession.wait_for` from
{attr}`~libvt.terminal.Terminal.committed_generation` and expire unclosed
`?2026` holds on `EOF`, {meth}`~libvt.aio.AsyncTerminalStream.aclose`, and
{meth}`~libvt.aio.PtySession.aclose`.

#### Bounded ASCII integer parsing and UTF-8 event accounting (#23)

{class}`~libvt.parser.Parser`, {class}`~libvt.terminal.Terminal`,
{mod}`libvt.graphics`, {mod}`libvt.status`, and {mod}`libvt.tmux` parse numeric
parameters strictly from ASCII digits `0`–`9` with bounded accumulators
(`<= 65535` for `OSC` command codes, unsigned 32-bit Kitty `i=` / `I=` / `p=` /
`P=` / `Q=` identifiers, and signed 32-bit `OSC 133;D` exit codes), while
{meth}`~libvt.terminal.Terminal.feed` isolates malformed `OSC 7` / `OSC 9;9`
URIs and non-hex `OSC 10` / `OSC 11` color specs without raising `ValueError`.
Event retention limits charge UTF-8 payload bytes across every `Event` variant
in {mod}`libvt.events` under {attr}`~libvt.config.Limits.max_event_bytes`.

#### Per-terminal sync isolation and horizontal-margin edits (#22)

{meth}`~libvt.terminal.Terminal.sync_token` and
{meth}`~libvt.terminal.Terminal.changes_since` isolate row-mutation watermarks
per {class}`~libvt.terminal.Terminal` instance and report every cell,
soft-wrap, and direct {attr}`~libvt.terminal.Terminal.screen` mutation in
{attr}`~libvt.terminal.ScreenDelta.dirty_rows`, while `ICH` and `DCH` outside
`DECLRMM` horizontal margins leave soft-wrapped rows intact.

#### Graphics retention, `DECSTBM` `SIXEL` masking, and streaming reflow (#21)

{meth}`~libvt.graphics.GraphicsTracker.on_region_scroll` preserves `SIXEL`
visibility masks and scrollback-bound placements when `DECSTBM` top-zero
margins advance scrollback history. {meth}`~libvt.terminal.Terminal.resize`
and {meth}`~libvt.screen.Screen.resize` retain stored images and placements
across reflow and non-reflow resizes, stream unwrapped scrollback lines that
fit within `cols` in `O(1)` per row without reallocating history blocks,
preserve monotonic {attr}`~libvt.terminal.Snapshot.scrolled_total`
continuity, and remap {class}`~libvt.events.PromptZone` and cell-anchored
Kitty {class}`~libvt.graphics.ImagePlacement` `(abs_row, col)` pins.

### Development

#### macOS PTY and Windows portable-core CI (#3)

GitHub Actions exercises Darwin {func}`~libvt.aio.open_pty` (`TIOCSCTTY`,
`TTYHOG` write queueing, and fast-exiting child drain) on `macos-latest` and
portable sans-I/O and {class}`~libvt.aio.AsyncTerminalStream` tests plus `ty`
checks on `windows-latest`, alongside the `Operating System :: Microsoft ::
Windows` classifier.

## libvt 0.0.1a0 (2026-11-22)

Initial pre-alpha release of `libvt`: a pure-Python, zero-dependency virtual
terminal emulator, streaming VT500 byte parser, mode-aware input encoder,
`asyncio` POSIX PTY adapter, and `pytest` plugin.

### What's new

#### Sans-I/O terminal core, two-tier RLE grid, and Unicode 17 width (#2)

{class}`~libvt.terminal.Terminal`, {class}`~libvt.screen.Screen`, and
{class}`~libvt.terminal.Snapshot` emulate primary and `?1049` alternate
screens with zero-based `(row, col)` coordinates, lazy 64-bit inline
viewport attributes, run-length-encoded scrollback history, and
primary-screen soft-wrap resize reflow. Top-level
{func}`~libvt.terminal.render`, {func}`~libvt.terminal.strip`, and
{func}`~libvt.codec.explain` helpers handle common rendering, stripping,
and sequence disassembly tasks, backed by `python -m libvt` CLI
subcommands.

{class}`~libvt.parser.Parser` decodes incremental UTF-8, colon-delimited
ITU T.416 SGR subparameters (`4:3`, `38:2::R:G:B`, `58:5:idx`), `G0`–`G3`
character-set designations (`ESC ( 0` DEC Special Graphics, `SO`/`SI`,
`SS2`/`SS3`), `HPR`/`VPR` (`CSI a` / `CSI e`), `CBT`/`CHT`,
`DECSCA`/`DECSED`/`DECSEL`, `CSI 3 J` / `CSI 22 J`, and `DCS tmux;`
passthrough framing while isolating UTF-8 `0x9C` and `U+009B` bytes from
8-bit `C1` controls (with optional `encoding="latin-1"` 8-bit wire mode).
SHA-256-pinned Unicode 17.0.0 two-stage tables drive East Asian width and
DEC `?2027` UAX #29 grapheme clustering across ZWJ emoji, Regional
Indicator flag pairs, Indic conjuncts, Hangul jamo, and `VS15` / `VS16`
emoji variation sequences. See {doc}`topics/architecture` for details.

#### Synchronized output stepping, Rex `OSC 7501`, and host queries (#2)

{meth}`~libvt.terminal.Terminal.committed`,
{meth}`~libvt.terminal.Terminal.feed_until`, and
{meth}`~libvt.terminal.Terminal.expire_synchronized_output` provide
lazy copy-on-write frame holds and generation-tagged timeout recovery
for DEC mode `?2026` synchronized updates.
{class}`~libvt.terminal.Formatter` exports snapshots to plain text, VT
escape sequences, and span-coalesced HTML with URI scheme allowlisting.

{class}`~libvt.status.ProgramStatusStore` and
{class}`~libvt.status.ProgramStatus` implement the Rex `OSC 7501`
Program Status specification, including hierarchical task identifiers,
ancestor `app` inheritance, urgency ranking, base64 `title`/`msg`
validation, profile- and policy-gated `OSC 7501 ; ?` capability replies,
`OSC 9;4` fallback, and lifecycle pruning alongside `OSC 133` prompt zones,
`OSC 7` RFC 8089 working directory updates, `OSC 52` clipboard writes,
`OSC 10`/`11` and `OSC 110`/`111` dynamic colors, `tmux` `ESC k` window
renames ({class}`~libvt.events.WindowRenamed`), `DA1`/`DA2`, `DSR`,
`DECRQM`, `DECRQSS`, `XTVERSION`, `XTGETTCAP`, and `?2031`/`?996n`
color-scheme queries. Configuration splits cleanly across {class}`~libvt.config.Profile`
(including versioned {meth}`~libvt.config.Profile.tmux` phantom-column
and resize compatibility profiles), {class}`~libvt.config.Policy`, and
{class}`~libvt.config.Limits`. See {doc}`topics/protocols-and-input` for
details.

#### Mode-aware input encoding, `asyncio` PTY bridge, and pytest plugin (#2)

{class}`~libvt.input.KeyEvent`, {class}`~libvt.input.MouseEvent`,
{class}`~libvt.input.FocusEvent`, and {class}`~libvt.input.PasteEvent`
encode outbound PTY bytes against active terminal modes, including
per-screen Kitty `CSI u` keyboard stacks (`>u`, `<u`, `=u`, `?u`), `SGR`
and `SGR-Pixel` mouse tracking (`?1006`, `?1016`), and fail-closed
bracketed paste validation raising {exc}`~libvt.exc.UnsafePasteError`.

{class}`~libvt.aio.AsyncTerminalStream` and {func}`~libvt.aio.open_pty`
connect sans-I/O terminals to `asyncio` streams and controlling POSIX
pseudo-terminals (`TIOCSCTTY` and `tty_mode`) without importing `asyncio`
or `pty` on `import libvt`. The `pytest11` plugin provides
protocol-typed `vt_terminal`, `vt_factory`, `vt_parser`, `vt_recorder`,
and `vt_pty` fixtures alongside {func}`~libvt.testing.assert_screen`,
{func}`~libvt.testing.assert_screen_box`,
{exc}`~libvt.exc.TerminalTimeoutError` stream diagnostics, and
{class}`~libvt.terminal.FlightRecorder` ring buffers. See
{doc}`topics/sync-and-asyncio` for details.

#### Incremental sync deltas, `tmux` capture reconstruction, and graphics (#13–#20)

{meth}`~libvt.terminal.Terminal.sync_token` and
{meth}`~libvt.terminal.Terminal.changes_since` emit non-destructive
multi-consumer {class}`~libvt.terminal.ScreenDelta` updates across both
`"committed"` (`?2026`-held) and `"working"` views, paired with
{meth}`~libvt.terminal.ScreenDelta.apply_lines`,
{meth}`~libvt.terminal.ScreenDelta.apply_rows`, and `O(1)` copy-on-write
{attr}`~libvt.terminal.Snapshot.history` sequence views.

{func}`~libvt.tmux.decode_tmux_capture`,
{class}`~libvt.tmux.TmuxPaneMetadata`, and
{func}`~libvt.tmux.unescape_tmux_control_output` reconstruct live
{class}`~libvt.terminal.Terminal` and {class}`~libvt.terminal.Snapshot`
state from `tmux capture-pane` (handling bare `SO`/`SI` ACS borders,
`GRID_FLAG_TAB` tabstops, `-F` / `-J` soft wraps, phantom-column
`pending_wrap`, and `-a` saved primary screens).
{mod}`libvt.graphics` tracks zero-dependency `SIXEL` and Kitty `APC G`
image metadata ({class}`~libvt.graphics.ImageMeta`) and monotonic
`abs_row` grid placements ({class}`~libvt.graphics.ImagePlacement` and
{meth}`~libvt.graphics.ImagePlacement.occupies_abs`) resolved alongside
{class}`~libvt.events.PromptZone` anchors via
{meth}`~libvt.terminal.Snapshot.at_abs` and
{meth}`~libvt.terminal.Snapshot.viewport_row`.
{exc}`~libvt.exc.TerminalTimeoutError` attaches multi-line viewport and
flight-recorder diagnostics via PEP 678 `__notes__` while keeping
`str(exc)` single-line.

### Documentation

- Add Architecture Decision Records `0001`–`0010` documenting clean-room
  provenance, sans-I/O layering, two-tier RLE storage, Unicode 17
  clustering, protocol semantics, input safety, and `asyncio`/pytest
  boundaries in {doc}`project/adr/index` (#2).
