# Migration notes

Migration and deprecation notes for `libvt` are recorded here; see
{ref}`changelog` as well.

`libvt` is in pre-alpha (`0.0.1a2`) and pre-1.0; pin `libvt>=0.0.1a2,<0.1` in
downstream projects (and `>=0.x,<0.y` once `0.1.0` is released).

---

## Upcoming Release

<!-- KEEP THIS PLACEHOLDER - DO NOT REMOVE OR MODIFY THIS LINE -->
_Detailed migration steps for the next version will be posted here._
<!-- END PLACEHOLDER - ADD NEW MIGRATION ENTRIES BELOW THIS LINE -->

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

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

Top-level {mod}`libvt` now exports only {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` via lazy PEP
562 attribute lookup. Import modes, styles, events, parsers, input encoders, and
sequence explainers from their owning submodules:

```python
# Before
from libvt import AnsiColor, KeyEvent, Mode, Parser, StopOn, 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
from libvt.terminal import StopOn
```

### `Policy.clipboard_read` and `allow_checksum_report` removal (#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`). Under
{attr}`~libvt.config.ClipboardReadPolicy.EMIT_EVENT`, `OSC 52 ; <sel> ; ?`
emits {class}`~libvt.events.ClipboardReadRequested` without fabricating empty
reply bytes; supply host clipboard replies explicitly via
{meth}`~libvt.terminal.Terminal.enqueue_reply`:

```python
# Before
pol = Policy(allow_clipboard_read=False, allow_checksum_report=False)

# After
from libvt.config import ClipboardReadPolicy, Policy

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

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

`tmux` profiles, `capture-pane` decoders, and `-CC` control-mode unescaping now
live in decoupled {mod}`libvt.contrib.tmux.profile`,
{mod}`libvt.contrib.tmux.capture`, and {mod}`libvt.contrib.tmux.control`
submodules (re-exported lazily on {mod}`libvt.contrib.tmux`), and core
{class}`~libvt.terminal.Terminal` / {class}`~libvt.terminal.Snapshot` no longer
carry `from_tmux_capture` constructors:

```python
# Before
from libvt import Profile, Snapshot, Terminal
from libvt.tmux import build_tmux_capture_command, unescape_tmux_control_output

prof = Profile.tmux("3.9")
term = Terminal.from_tmux_capture(lines, metadata=meta)
snap = Snapshot.from_tmux_capture(lines, metadata=meta)

# After
from libvt.contrib.tmux.capture import (
    build_tmux_capture_command,
    decode_tmux_capture,
)
from libvt.contrib.tmux.control import unescape_tmux_control_output
from libvt.contrib.tmux.profile import tmux_profile

prof = tmux_profile("3.9")
res = decode_tmux_capture(lines, metadata=meta)
term, snap = res.terminal, res.snapshot
```

### Open `Event` hierarchy and `WindowRenamed` consolidation (#38)

All event classes in {mod}`libvt.events` inherit from the open keyword-only
{class}`~libvt.events.Event` base class (`kw_only=True, match_args=False`), and
`WindowRenamed` is replaced by {class}`~libvt.events.TitleChanged` with
{attr}`~libvt.events.TitleTarget.TMUX_WINDOW_NAME`
({class}`~libvt.events.TitleTarget`). Switch positional `match` patterns to
keyword attributes, and annotate closed core-event handlers with
{type}`~libvt.events.KnownEvent`:

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

match event:
    case WindowRenamed(name):
        handle_tmux_rename(name)
    case TitleChanged(title):
        handle_title(title)

# After
from libvt.events import KnownEvent, TitleChanged, TitleTarget

match event:
    case TitleChanged(title=name, target=TitleTarget.TMUX_WINDOW_NAME):
        handle_tmux_rename(name)
    case TitleChanged(title=title):
        handle_title(title)
```

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

{class}`~libvt.config.Profile` organizes configuration into
{class}`~libvt.config.Identity`, {class}`~libvt.config.QueryBehavior`,
{class}`~libvt.config.ScreenBehavior`, {class}`~libvt.config.InputBehavior`,
and {class}`~libvt.config.UnicodeBehavior`, and host presets live in
{mod}`libvt.profiles`:

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

prof = Profile(cell_width_px=10, cell_height_px=20)
term = Profile.linux_console()

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

prof = Profile(screen=ScreenBehavior(cell_width_px=10, cell_height_px=20))
```

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

### `MouseEvent.pixel_x` and `pixel_y` default to `None` (#26)

{attr}`~libvt.input.MouseEvent.pixel_x` and
{attr}`~libvt.input.MouseEvent.pixel_y` now have type `int | None = None` so
`?1016` SGR-Pixel encoding derives cell-center coordinates when omitted; pass
`pixel_x=0, pixel_y=0` explicitly when origin `(0, 0)` pixels are intended:

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

# After (explicit origin pixels)
ev = MouseEvent(
    button=MouseButton.LEFT,
    action=MouseAction.PRESS,
    row=2,
    col=3,
    pixel_x=0,
    pixel_y=0,
)
```

### `CSI 5:3 m` overline scoped to `tmux` capture decoding (#18)

{func}`~libvt.parser.parse_sgr` and live {meth}`~libvt.terminal.Terminal.feed`
no longer treat `CSI 5:3 m` as overline (or blink); emit standard `CSI 53 m` on
live VT streams and pass `tmux capture-pane -e` output through
{func}`~libvt.tmux.decode_tmux_capture` or
{meth}`~libvt.terminal.Terminal.from_tmux_capture`:

```python
# Before
term.feed(b"\x1b[5:3moverline\x1b[0m")

# After
term.feed(b"\x1b[53moverline\x1b[0m")
cap_term = Terminal.from_tmux_capture(["\x1b[5:3moverline\x1b[0m"])
```

### Opaque `SyncToken` watermarks (#22)

{class}`~libvt.terminal.SyncToken` no longer exposes internal watermark fields
or direct construction; obtain tokens from
{meth}`~libvt.terminal.Terminal.sync_token` or
{attr}`~libvt.terminal.ScreenDelta.token` and inspect terminal state via
{attr}`~libvt.terminal.ScreenDelta.snapshot`:

```python
# Before
cur = tok.cursor

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