Repository navigation
Done
Labels
enhancementNew feature or request
Description
Summary
Wave 3 input and async-driving slice of #34 (runnable in parallel with Wave 3 Appearance, pairing with XTSAVE/XTRESTORE in #29): add DECARM (?8), DECNKM (?66), and DECBKM (?67) input modes while keeping Terminal.encode() stateless, add MouseTracker in src/libvt/input.py, and add bidirectional outbound driving on AsyncTerminalStream behind a narrow AsyncSession Protocol in src/libvt/aio.py.
Motivation
- Full-screen TUIs toggle
DECNKM(?66application keypad),DECBKM(?67backarrow sendsBS0x08vsDEL0x7f), andDECARM(?8auto-repeat) alongsideXTSAVE/XTRESTORE(SupportXTSAVE(CSI ? Pm s) andXTRESTORE(CSI ? Pm r) private mode save/restore #29), and?1002button-event mouse tracking suppresses repeated motion reports within the same cell—state that breaks read-only callers if mutated insideTerminal.encode(). AsyncTerminalStreamcurrently accepts only a read-sideStreamReader(plus optional reply sink), so cross-platform pipe/socket tests on Windows and POSIX cannot drivesend_key(),send_event(), orpaste()through the same interactive interface asPtySession.
Proposal
- Add
Mode.AUTO_REPEAT(?8),Mode.APPLICATION_KEYPAD(?66, reconciled withDECKPAMESC =andDECKPNMESC >), andMode.BACKARROW_IS_BS(?67) insrc/libvt/modes.py,src/libvt/input.py, andsrc/libvt/terminal.py, keepingTerminal.encode(event)pure (repeat=Truedropped when?8is reset unless KittyREPORT_EVENT_TYPESis active). - Add a session-scoped
MouseTrackerhelper insrc/libvt/input.pythat suppresses duplicate same-cell?1002drag motion events while passing?1003any-event motion and button transitions through unchanged, wired intoAsyncTerminalStream.send_event()andPtySession.send_event(). - Extend
AsyncTerminalStreamwith optional outbound writer support (send,send_event,send_key,paste,drain,write_eof) and export a structuralAsyncSessiont.Protocol(terminal,send,send_event,send_key,paste,drain,wait_for,aclose) implemented by bothAsyncTerminalStreamandPtySession, keepingreturncode,TIOCSWINSZresize(), LinuxEIOEOF, and process-group termination exclusive toPtySession. - Keep outbound queueing single-FIFO with atomic frame writes so auto-replies drained from
Terminalnever interleave inside a bracketedpaste()frame (ESC[200~..ESC[201~), and keep the inbound reader loop running unconditionally without awaiting outbounddrain()so full child stdin pipes never deadlock PTY/pipe reads.
Alternatives
- Storing
last_mouse_celldirectly onTerminaland mutating it insideTerminal.encode(ev): rejected because logging or assertingterm.encode(ev)beforesession.send_event(ev)would silently swallow the outbound mouse drag event. - Adding
AsyncTerminalStream.from_blocking()viaasyncio.to_threadin0.1.0: rejected until post-0.1.0because blockingread()worker threads cannot be cancelled deterministically onaclose().
References
- Design specification, roadmap, and paired mode save/restore issue: Move
tmuxtolibvt.contrib.tmuxand harden pre-0.1core APIs #34,0.0.xto0.1.0and beyond Roadmap #35, SupportXTSAVE(CSI ? Pm s) andXTRESTORE(CSI ? Pm r) private mode save/restore #29 - Files touched at 6c33073:
src/libvt/modes.py,src/libvt/input.py,src/libvt/aio.py,src/libvt/terminal.py
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Type
Projects
- StatusShow more project fieldsDone
Activity
0.1.0API waves aroundterminal.pyserialization #36OSC 52Policycontrols inlibvt#40libvt.__all__behind PEP 562 and gatepytest11imports #43aio(docs[session]): Link stream methods in docs
aio(docs[session]): Link stream methods in docs