Repository navigation
Expand file tree
/
Copy pathMIGRATION
More file actions
377 lines (288 loc) · 13.8 KB
/
Copy pathMIGRATION
File metadata and controls
377 lines (288 loc) · 13.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
# Migration notes
Migration and deprecation notes for `libvt` are recorded here; see
{ref}`changelog` as well.
`libvt` is in pre-alpha (`0.0.1a6`) and pre-1.0; pin `libvt>=0.0.1a6,<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.1a6 (2026-12-05)
### Alternate-screen entry with the tmux profile (#119)
The tmux profile carries the current cursor, including pending wrap,
into the blank alternate screen. Send `CSI H` after entering if the
application draws from the top left.
### Kitty F3 and special-key releases (#82, #118)
Expect the `CSI 13 ~` form for F3 when disambiguation or event reporting
is active. Modifiers and event types occupy the second parameter. Combine
`REPORT_EVENT_TYPES` with `REPORT_ALL_KEYS` to receive Enter, Tab, and
Backspace releases.
### tmux capture and attach
On tmux 3.2 and later, `XTVERSION` replies include the release suffix
supplied to the capture command. Earlier versions emit no reply. To
select a different identity, pass `profile=` to the command's `parse()`
method. For tmux 3.1c, use a one-shot pane capture.
For raw {func}`~libvt.contrib.tmux.capture.decode_tmux_capture` input,
pass the version of the server that emitted the bytes. A widening emoji
presentation selector from an unknown or pre-3.5 release now leaves
`exact_cells` false. Read an attached client's screen when the column of
the next character matters.
### VT snapshot output retains the terminal pen
{meth}`~libvt.snapshot.Snapshot.format` with
{attr}`~libvt.format.OutputFormat.VT` ends with the captured pen and
cursor state. When appending unrelated text, set its cursor position
and rendition before writing. Close a captured OSC 8 hyperlink with
`OSC 8 ; ; ST` and reset SGR and DECSCA with `CSI 0 m` and `CSI 0 " q`.
### Mouse mode selection and modifiers (#83, #111)
Select the desired tracking mode and coordinate format explicitly. Each
request replaces the prior selection in its group. Resetting tracking
turns tracking off. Resetting the selected coordinate format restores
classic coordinates. `GHOSTTY_PROFILE` also clears the format when the
inactive SGR format is reset.
Update wire expectations for classic releases to include their Shift, Alt,
and Ctrl bits. X10 sends plain button codes for left, middle and right
presses. Select `?1000h`, `?1002h` or `?1003h` to report wheel presses.
### Drain interrupted by close (#81)
Concurrent close can interrupt a pending `drain()` with
`OSError(errno.ECANCELED)`. Await the stream drain before closing when
queued writes should flush. For a PTY, pass `write_high_water=0` to
{func}`~libvt.aio.open_pty` to drain its entire outbound queue.
### PTY process exit and terminal EOF (#89)
Keep the session open until terminal EOF when capturing the last output
from a worker after the direct child exits. Use
`await session.wait_for(lambda _: session.eof, timeout=3)` before leaving
the context. Read `session.closed_before_eof` to tell whether teardown
began while the PTY was still open.
### Flight recorder retention (#99)
Use an explicit `max_bytes=64` to retain the former minimum. An eight-byte
limit now retains eight bytes. Pass zero to count bytes without storing
them. Negative limits raise `ValueError` before a PTY child starts.
### Missing tmux paste and tab metadata
Read `result.metadata.bracketed_paste_flag` before sending a paste to
a late-attached pane. To distinguish unknown from disabled, branch on
`None` first. The input encoder still emits plain text for both cases.
```python
# Before
paste_disabled = not result.metadata.bracketed_paste_flag
# After
flag = result.metadata.bracketed_paste_flag
paste_disabled = flag is False
paste_unknown = flag is None
```
A known empty ruler is now `()`. A missing ruler remains `None`.
Inspect `result.completeness.unexposed_fields` for
`historical_tabstops` before relying on reconstructed cell coordinates.
### Paired tmux capture bundle sections (#80)
Generate the capture command and parse its stdout with the same
{class}`~libvt.contrib.tmux.capture.TmuxCaptureCommand`. On tmux 3.4 and
later, recorded bundle fixtures need the `UNTRIMMED` section after
`CAPTURE` and the `SAVED_UNTRIMMED` section after `SAVED` when saved
primary capture is enabled. Regenerate those fixtures with
{func}`~libvt.contrib.tmux.capture.build_tmux_capture_command`.
Preserve empty lines within each section or pass the command's raw
stdout. The decoder reports `capture_rows` and clears `exact_cells` and
`exact_wraps` if a capture is missing requested rows.
Callers that retain only raw `capture-pane -N -T` rows can pass them to
{func}`~libvt.contrib.tmux.capture.decode_tmux_capture` with
`trim_trailing=True`. Supply the matching `-N` rows as
`untrimmed_capture` to recover erased backgrounds.
### `TmuxPaneSync` control-client writes (#75)
Write the whole string from
{meth}`~libvt.contrib.tmux.control.TmuxPaneSync.begin_attach`,
{meth}`~libvt.contrib.tmux.control.TmuxPaneSync.resync`, or
{meth}`~libvt.contrib.tmux.control.TmuxPaneSync.handle_event` with a final
newline. Keep the marker and command lines together when sharing stdin.
If your tests synthesize command replies, echo the marker before the batch
replies. A successful pause batch ends by printing the target's pane ID.
### tmux layout changes request a native capture (#71)
Send any command returned by
{meth}`~libvt.contrib.tmux.control.TmuxPaneSync.handle_event` to the control
client. After a pane size change the terminal keeps its previous frame
until the coordinator returns to `LIVE`. Read the new geometry from the
same terminal after that checkpoint. Check its
{ref}`bookmark epoch <tmux-row-bookmarks>` before reusing an absolute row.
### `TmuxPaneSync` session scope (#76)
Handle `OUT_OF_SCOPE` alongside `LIVE` and `FAILED` when awaiting an
attachment. `terminal` holds the last screen when the pane moves away and
is `None` when the pane was never attached. Send `resync()` through a control
client attached to a session that contains the pane.
### Boxed snapshot scrubbers match one row at a time (#149)
Set the child process's `TMPDIR` and choose viewport dimensions that keep
dynamic values on one row before passing them to
{func}`~libvt.testing.vt_screen`. Match padding explicitly when masking a
fixed-width field. For logical text from a line-oriented command, scrub
the output of {func}`~libvt.terminal.strip`. Use {ref}`topics-testing`
for runnable examples.
### Scrubbing paths and file URIs (#150)
When switching a snapshot scrubber from a regex to a path object, pass a
separate rule for each URI you want to scrub. For a local absolute
`pathlib.Path` displayed within one row, use
`[(path, "<PATH>"), (re.escape(path.as_uri()), "<URI>")]`. Pass the source
frame with `region=` when a crop omits part of a wrapped URI.
### Boxed step diffs (#151)
{func}`~libvt.testing.vt_screen` with `diff=` and {fixture}`vt_snapshot` with
`diff=` pair rows at the same viewport index. Container snapshots store VT
frames with supported key paths in separate sections. Frames with ambiguous
display columns record those columns in a footer. Review the diff and
regenerate affected `.ambr` expectations with `pytest --snapshot-update`.
### String predicates match logical lines (#152)
{meth}`~libvt.aio.AsyncTerminalStream.wait_for` and
{meth}`~libvt.aio.PtySession.wait_for` match strings against
{attr}`~libvt.snapshot.Snapshot.unwrapped_text`. Replace a string that includes
a soft-wrap boundary with a callable that inspects the physical rows.
```python
# Before
await session.wait_for("hello wo\nrld")
# After
await session.wait_for(lambda snap: "hello wo\nrld" in snap.text)
```
## 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.views.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.snapshot.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.snapshot.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.snapshot.SyncToken` no longer exposes internal watermark fields
or direct construction; obtain tokens from
{meth}`~libvt.terminal.Terminal.sync_token` or
{attr}`~libvt.snapshot.ScreenDelta.token` and inspect terminal state via
{attr}`~libvt.snapshot.ScreenDelta.snapshot`:
```python
# Before
cur = tok.cursor
# After
delta = term.changes_since(tok)
cur = delta.snapshot.cursor
```