Repository navigation
Done
Labels
enhancementNew feature or request
Description
Summary
Wave 2 policy slice of #34 (gated on Wave 1 open Event base): add Policy.emit_replies: bool = True for passive stream observers, replace Policy.allow_clipboard_read: bool with a default-deny enum that emits ClipboardReadRequested(Event) instead of fabricating empty OSC 52 clipboard replies, remove unreferenced Policy.allow_checksum_report, and expose Terminal.enqueue_reply(data: bytes) plus Parser.at_ground_state.
Motivation
- When
Terminalmirrors a tmux-CC%outputstream (Add byte-orientedTmuxControlParserand two-phase-CCPaneAttach#27), thetmuxserver has already answered paneDAandDSRqueries; queueing a second set of replies onTerminaleither leaks unread bytes or double-injects responses if forwarded. src/libvt/terminal.pyanswersOSC 52 ; <sel> ; ?underPolicy(allow_clipboard_read=True)withb"\x1b]52;{sel};\x1b\\"(claiming an empty clipboard rather than delegating to a host clipboard provider).Policy.allow_checksum_reporthas zero references insrc/libvt/terminal.py, and implementingDECRQCRA(CSI * y) would require per-cell extension state on ASCII' 'cells insrc/libvt/_grid.pywith zero callers in libtmux or modern terminal peers.
Proposal
- Add
emit_replies: bool = TrueonPolicysoemit_replies=Falsesuppresses all automatic terminal reply generation (DA1/DA2/DA3,DSR,CPR,DECRPM,XTVERSION,DECRQSS,XTGETTCAP,CSI ? u,OSC 4/10–12queries, and?2031notifications) while keeping screen mutations andEventemission intact; expose a passive-observerPolicypreset inlibvt.contrib.tmux.profile. - Replace
allow_clipboard_read: bool = FalseonPolicywithclipboard_read: ClipboardReadPolicy = ClipboardReadPolicy.IGNORE(IGNOREdropsOSC 52 ; <sel> ; ?;EMIT_EVENTemitsClipboardReadRequested(selection=...)with zero fabricated reply bytes), and addTerminal.enqueue_reply(data: bytes)so a host driver that servicesClipboardReadRequestedcan inject a realOSC 52response into the single reply queue. - Delete
allow_checksum_reportfromPolicybefore0.1.0, leavingCSI * y(DECRQCRA) a parser-dispatched no-op. - Expose a read-only
Parser.at_ground_state: boolproperty onParser(state == ParserState.GROUNDand no buffered multibyte UTF-8 sequence) so external stream multiplexers and recorders know when chunk boundaries are sequence-safe without exposing mutable internal checkpoints.
Alternatives
- Passing a synchronous
clipboard_provider: Callable[[str], bytes]callback onPolicy: rejected becausePolicyis a frozen, hashable configuration value and host clipboard access inasynciotest drivers is often asynchronous.
References
- Design specification, roadmap, and
-CCobserver consumer: Movetmuxtolibvt.contrib.tmuxand harden pre-0.1core APIs #34,0.0.xto0.1.0and beyond Roadmap #35, Add byte-orientedTmuxControlParserand two-phase-CCPaneAttach#27 - Files touched at 6c33073:
src/libvt/config.py,src/libvt/terminal.py,src/libvt/parser.py,src/libvt/events.py
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Type
Projects
- StatusShow more project fieldsDone
Activity
0.1.0API waves aroundterminal.pyserialization #36Eventan open base class and normalizeOSC 133/OSC 633#38Appearanceacross?2026holds andset_theme()#41?8/?66/?67input modes,MouseTracker, andAsyncSession#42libvt.__all__behind PEP 562 and gatepytest11imports #43TmuxControlParserand two-phase-CCPaneAttach#27