Repository navigation
Done
Labels
enhancementNew feature or request
Description
Summary
Wave 3 frame-state slice of #34 (gated on Wave 2 Policy.emit_replies): add an immutable Appearance record to src/libvt/style.py and commit it atomically inside Snapshot and _SyncState across ?2026 synchronized-output holds, wire Formatter to render snapshot appearance and DECSCNM (?5) reverse video, and add Terminal.set_theme() for host palette/scheme updates and ?2031 (CSI ? 997 ; Ps n) notifications.
Motivation
Terminalstores mutable_fg_rgb,_bg_rgb,_cursor_rgb, and_palette_overridesoutsideSnapshot, soOSC 4andOSC 10throughOSC 12mutations during a?2026BSUhold leak out of sync withTerminal.committedandScreenDelta, andFormatter.format_snapshot()ignores dynamic palette overrides when rendering ANSI or HTML output.libvttracks mode?2031(DECSET 2031) and definesColorScheme, yetTerminalhas noset_theme()entry point to update host default colors (OSC 104andOSC 110throughOSC 112reset targets) or queueCSI ? 997 ; 1 n/CSI ? 997 ; 2 nunsolicited reports when the host theme changes.
Proposal
- Define
@dataclass(frozen=True, slots=True) class Appearanceinsrc/libvt/style.pyholdingscheme: ColorScheme, effective defaultfg_rgb,bg_rgb, andcursor_rgb, sparsepalette_overrides: tuple[tuple[int, tuple[int, int, int]], ...], andreverse_video: bool(DECSCNM?5), and exposeSnapshot.appearance: Appearanceinside one committed frame bundle swapped atomically on?2026ESU(withappearance_revisiontracked on_SyncStateandScreenDelta). - Separate host theme defaults (set via
Terminal.set_theme(scheme=..., fg_rgb=..., bg_rgb=..., cursor_rgb=..., palette=...)) from guestOSC 4andOSC 10throughOSC 12overrides soOSC 104,OSC 110–112,DECSTR, andRISrestore the active host defaults cleanly. - Emit
CSI ? 997 ; Ps n(Ps = 1dark,Ps = 2light) fromTerminal.set_theme()when?2031is active (gated byPolicy.emit_replies) on bothschemeflips and host palette/default-color changes per Contour palette update notifications, and applyAppearanceplusDECSCNM(?5) inFormatter.format_snapshot().
Alternatives
- Reading
Terminal's live_fg_rgb,_bg_rgb, and_palette_overridesinsideFormatter: rejected becauseFormatter.format_snapshot(snap)operates on detachedSnapshotvalues and live reads violate?2026frame atomicity.
References
- Design specification and roadmap: Move
tmuxtolibvt.contrib.tmuxand harden pre-0.1core APIs #34,0.0.xto0.1.0and beyond Roadmap #35 - Files touched at 6c33073:
src/libvt/style.py,src/libvt/terminal.py,src/libvt/modes.py - Specifications: Contour synchronized output (
?2026), Contour palette update notifications (?2031)
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Type
Projects
- StatusShow more project fieldsDone
Activity
0.1.0API waves aroundterminal.pyserialization #36tmuxinto decoupledlibvt.contrib.tmuxsubmodules #39OSC 52Policycontrols inlibvt#40libvt.__all__behind PEP 562 and gatepytest11imports #43terminal(docs[sync]): Wrap sync-and-asyncio prose
terminal(docs[sync]): Wrap sync-and-asyncio prose