Repository navigation
Done
Labels
enhancementNew feature or request
Description
Summary
Real-world TUI startup sequences (nvim, fzf, yazi, crossterm, termenv / lipgloss) probe OSC 4 ; idx ; ?, chained OSC 10 ; ? ; ? (10/11/12) plus OSC 104/110/111/112 resets, XTMODKEYS (CSI > 4 ; pv m and CSI ? 4 m), ?1007 alternate-screen wheel-to-arrow scroll, pixel-calibrated ?1016 / ?2048 / TIOCSWINSZ dimensions, and XTSMGRAPHICS (CSI ? Pi ; Pa ; Pv S) fenced by DA1/DSR sentinels, while desktop notification sequences (OSC 9, OSC 99, OSC 777) currently emit UnhandledSequence noise (#2).
Motivation
Terminal._handle_osc()currently handlesOSC 10 ; ?andOSC 11 ; ?only whendata == b"?"(missing chainedOSC 10;?;?emitted byxterm/termenvprobes,OSC 12cursor color set/query +OSC 112reset, andOSC 4/OSC 104256-palette set/query/reset).- When
nvimdeclines or probesCSI ? uKitty keyboard mode, it sendsCSI > 4 ; 2 m(modifyOtherKeyslevel 2) and may queryCSI ? 4 m; trackingmodify_other_keys(0,1,2) per screen and encoding modified keys inKeyEventkeepsnvimkey chords working out of the box. - On the alternate screen with mouse tracking disabled and
?1007(ALTERNATE_SCROLL) enabled (default in modern terminals andless/manpagers), mouse wheel events translate intoUp/Downcursor keys (DECCKM-aware). ?1016MouseEventencoding currently emits rawpixel_x/pixel_yeven when negative or unset (0instead of deriving cell-center/clamped non-negative coordinates fromcell_width_px/cell_height_px), andTerminal.resize()/PtySession.resize()hard-code0;0pixel sizes inCSI 48 ; rows ; cols ; px_h ; px_w t(?2048) andTIOCSWINSZ.- Answering
XTSMGRAPHICS(CSI ? Pi ; Pa ; Pv S) with non-blocking error statusCSI ? Pi ; 3 SpreventsSIXEL-probing applications from stalling on a sentinel timeout, while silently acceptingOSC 9(text notification),OSC 99(Kitty notification), andOSC 777(notify;...) prevents falseUnhandledSequenceerrors underPolicy.strict=Trueor event recording.
Proposal
Invariants
The invariants below are load-bearing; everything under Intent is open.
- All query replies (
OSC 4/10/11/12,DECRQMreturning0for any unrecognized ANSI/DEC mode,XTGETTCAP,XTSMGRAPHICS,XTMODKEYS?4m,DA1/DA2,DSR) enqueue in exact arrival order and respectPolicy.allow_color_queriesandLimits.max_reply_bytes. ?1016SGR-Pixel mouse coordinates are clamped to>= 0(deriving default pixel coordinates from(col, row)and(cell_width_px, cell_height_px)when explicit pixel coordinates are not supplied, or gating?1016when pixel geometry is0).Terminaldocumentation states single-threaded ownership explicitly (mutation and inspection belong to one thread/event-loop unless externally synchronized, while immutableSnapshotobjects may be shared freely across threads).
Intent (non-binding)
- Store sparse palette overrides (
dict[int, tuple[int, int, int]]) and_cursor_rgbonTerminal(reset byOSC 104,OSC 112, andRIS), support semicolon-chainedOSC 10;?;?(10,11,12) queries, addMode.ALTERNATE_SCROLL = DEC_PRIVATE_MASK | 1007, trackmodify_other_keys: int(0..2) onScreen, report pixel dimensions in?2048andPtySession.resize(), reply�[?{pi};3StoCSI ? Pi ; Pa ; Pv S, and consumeOSC 9/99/777without emittingUnhandledSequence.
Not doing
- Implementing full stateful
XTSMGRAPHICScolor/geometry register mutation,XTSAVE/XTRESTORE, KittyREPORT_ALTERNATE_KEYS/REPORT_ASSOCIATED_TEXT, or structured notificationEventdataclasses in0.1.0(tracked separately for0.2.0).
References
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Activity
terminal(feat[vt]): Add OSC 4/12, XTMODKEYS (#26)