Documentation ¶
Overview ¶
Package tty provides terminal functionality for the Elvish editor.
Index ¶
Constants ¶
const DefaultSeqTimeout = 10 * time.Millisecond
DefaultSeqTimeout is the amount of time within which runes that make up an escape sequence are supposed to follow each other. Modern terminal emulators send escape sequences very fast, so 10ms is more than sufficient. SSH connections on a slow link might be problematic though.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CursorPosition ¶
type CursorPosition Pos
CursorPosition represents a report of the current cursor position from the terminal driver, usually as a response from a cursor position request.
type Event ¶
type Event interface {
// contains filtered or unexported methods
}
Event represents an event that can be read from the terminal.
type FatalErrorEvent ¶
type FatalErrorEvent struct{ Err error }
FatalErrorEvent represents an error that affects the Reader's ability to continue reading events. After sending a FatalError, the Reader makes no more attempts at continuing to read events and wait for Stop to be called.
type MouseEvent ¶
type MouseEvent struct { Pos Down bool // Number of the Button, 0-based. -1 for unknown. Button int Mod ui.Mod }
MouseEvent represents a mouse event (either pressing or releasing).
type NonfatalErrorEvent ¶
type NonfatalErrorEvent struct{ Err error }
NonfatalErrorEvent represents an error that can be gradually recovered. After sending a NonfatalError, the Reader will continue to read events. Note that one anamoly in the terminal might cause multiple NonfatalError events to be sent.
type PasteSetting ¶
type PasteSetting bool
PasteSetting indicates the start or finish of pasted text.
type Pos ¶
type Pos struct {
// contains filtered or unexported fields
}
Pos is the position in a terminal.
type Reader ¶
type Reader interface { // SetRaw turns the raw mode on or off. In raw mode, the Reader does not // decode special sequences, but simply deliver them as RawRune events. If // the Reader is in the middle of reading one event, it takes effect after // this event is fully read. On platforms (i.e. Windows) where events are // not encoded as special sequences, SetRaw has no effect. SetRaw(bool) // EventChan returns the channel onto which the Reader writes events that it // has read. EventChan() <-chan Event // Start starts the Reader. Start() // Stop stops the Reader. Stop() // Close releases resources associated with the Reader. It does not affect // resources used to create it. Close() }
Reader reads terminal events and makes them available on a channel.
type Writer ¶
type Writer interface { // CurrentBuffer returns the current buffer. CurrentBuffer() *ui.Buffer // ResetCurrentBuffer resets the current buffer. ResetCurrentBuffer() // CommitBuffer updates the terminal display to reflect current buffer. CommitBuffer(bufNoti, buf *ui.Buffer, fullRefresh bool) error }