termreply

package
v1.7.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2026 License: MIT Imports: 2 Imported by: 0

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 Clear

func Clear()

Clear removes any active quarantine window. Intended for tests.

func QuarantineFor

func QuarantineFor(duration time.Duration)

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

func (f *Filter) Active() bool

Active reports whether the filter is carrying parser state across read boundaries.

func (*Filter) Consume

func (f *Filter) Consume(src []byte, armed bool, final bool) []byte

Consume filters a chunk of bytes. When armed is true, terminal-generated control replies are discarded. If a reply started in a previous chunk, it continues to be discarded until it terminates even if armed is now false.

Terminal replies covered here:

  • escape-string families: OSC, DCS, APC, PM, SOS
  • CSI replies during the quarantine window, except for a small whitelist of keyboard-related CSI finals (arrows/home/end/backtab/~ keys/kitty CSI u)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL