tty

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2017 License: BSD-2-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// EscSequenceTimeout 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.
	EscSequenceTimeout = 10 * time.Millisecond
)

Functions

This section is empty.

Types

type AsyncReader

type AsyncReader struct {
	// contains filtered or unexported fields
}

AsyncReader delivers a Unix fd stream to a channel of runes.

func NewAsyncReader

func NewAsyncReader(rd *os.File) *AsyncReader

NewAsyncReader creates a new AsyncReader from a file.

func (*AsyncReader) Chan

func (ar *AsyncReader) Chan() <-chan rune

Chan returns a channel onto which the AsyncReader writes the runes it reads.

func (*AsyncReader) Close

func (ar *AsyncReader) Close()

Close releases files and channels associated with the AsyncReader. It does not close the file used to create it.

func (*AsyncReader) ErrorChan

func (ar *AsyncReader) ErrorChan() <-chan error

ErrorChan returns a channel onto which the AsyncReader writes the errors it encounters.

func (*AsyncReader) Quit

func (ar *AsyncReader) Quit()

Quit terminates the loop of Run.

func (*AsyncReader) Run

func (ar *AsyncReader) Run()

Run runs the AsyncReader. It blocks until Quit is called and should be called in a separate goroutine.

type MouseEvent

type MouseEvent struct {
	Pos
	Down bool
	// Number of the Button, 0-based. -1 for unknown.
	Button int
	Mod    uitypes.Mod
}

type Pos

type Pos struct {
	// contains filtered or unexported fields
}

Pos is the position in a terminal.

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

Reader converts a stream of events on separate channels.

func NewReader

func NewReader(f *os.File) *Reader

NewReader creates a new Reader on the given terminal file.

func (*Reader) CPRChan

func (rd *Reader) CPRChan() <-chan Pos

CPRChan returns the channel onto which the Reader writes CPRs it has read.

func (*Reader) Close

func (rd *Reader) Close()

Close releases files associated with the Reader. It does not close the file used to create it.

func (*Reader) ErrorChan

func (rd *Reader) ErrorChan() <-chan error

ErrorChan returns the channel onto which the Reader writes errors it came across during the reading process.

func (*Reader) KeyChan

func (rd *Reader) KeyChan() <-chan uitypes.Key

KeyChan returns the channel onto which the Reader writes Keys it has read.

func (*Reader) MouseChan

func (rd *Reader) MouseChan() <-chan MouseEvent

MouseChan returns the channel onto which the Reader writes mouse events it has read.

func (*Reader) PasteChan

func (rd *Reader) PasteChan() <-chan bool

func (*Reader) Quit

func (rd *Reader) Quit()

Quit terminates the loop of Run.

func (*Reader) Run

func (rd *Reader) Run()

Run runs the Reader. It blocks until Quit is called and should be called in a separate goroutine.

Notes

Bugs

  • AsyncReader relies on the undocumented fact that (*os.File).Read returns an *os.File.PathError

Jump to

Keyboard shortcuts

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