Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Active ¶
func Active() bool
Active reports whether terminal replies should currently be discarded.
func QuarantineFor ¶
QuarantineFor drops terminal reply traffic until the later of the existing deadline or now+duration.
Types ¶
type Filter ¶
type Filter struct {
// contains filtered or unexported fields
}
Filter strips terminal-generated control replies from a byte stream while preserving ordinary keyboard input. It is stateful so replies split across reads are discarded without relying on terminal-specific payload strings.
func (*Filter) Active ¶
Active reports whether the filter is carrying parser state across read boundaries.
func (*Filter) Consume ¶
Consume filters a chunk of bytes. Escape-string replies (OSC/DCS/APC/PM/SOS) are discarded unconditionally — they have no keyboard overlap, so a human cannot produce them, and leaking them to the inner PTY has real-world failure modes (see #731: iTerm2 XTVERSION DCS leaking as `TERM2 3.6.10n` input into the wrapped agent).
CSI sequences are handled by final-byte whitelist:
- Keyboard/mouse CSIs (arrows, Home/End, backtab, ~ keys, kitty CSI u, mouse M/m) always pass through so user input is never corrupted.
- DA/DSR replies (final bytes c/n/R) always pass through so tmux can negotiate modifyOtherKeys with the host terminal (see #738: @Clean-Cole identified that swallowing DA1 collapsed Shift+Enter to bare CR in iTerm2 default profile).
- Anything else is gated by armed: discarded during the quarantine window, preserved outside it.
If a reply started in a previous chunk, it continues to be discarded until it terminates even if armed is now false.
If final is true, any incomplete pending escape/CSI/SS3 sequence is flushed as literal input, while an incomplete discarded escape-string reply is dropped.